Question: making basic collision work with clayxels

Hello,

When following the tutorial on the obstacle course, I thought I would have a bit of fun and try to combine it with making a character in Clayxels. Clayxels uses a Claxels container, in which you can add clay and make all kinds of interesting shapes. For the collision Part I added an box collider to the clay container and edited it to be the right size. I also added a rigidbody. Gravity seems to work, but the walls dont stop my character. They do seem to push it back a little bit. Any idea on what i could change to make it work?

Kind regards

.Schermafbeelding 2021-03-21 102415

Hi Paula,

In Unity, “physical” collisions only happen between two non-trigger colliders, never between “pictures” (or 3D meshes). If a collision does not work, the first thing you could do is to check if the player and the walls have got Collider components attached in their respective Inspector. Also check the shape of the colliders. They must be large enough to cover the “pictures” (or 3D meshes) where the collision is supposed to happen.

If you cannot fix the issue, are there any error messages in your console?

1 Like

Both the walls and the player (An 3d object) have a box collider that fits and are set on non trigger. I’m not getting any error messages. Tomorrow I will go through the steps again, to see if there is something else I might have missed.

Okay, I’ve found out that the collider works when I set the speed of my player a lot lower. It doesnt work if I move faster. I retried all the steps with a normal cube, but still getting the same results. Any ideas what this might be? Thank you!

Unity cannot handle fast moving objects well. How fast was your player? It does not have to be as slow as a snail but it should not be moving at high speed.

You could try the following:

  1. Since the walls are not supposed to move, enable “Static” in their Inspector to increase the performance of the physics simulation. Do not do that for moving objects. Otherwise, you will get a negative impact on the performance.
  2. Add a Rigidbody to the player (if you haven’t already).

The test your game. If the issue persists, make sure the colliders are not just a thin something but large.

If that’s the case, set the “Collision Detection” of the Rigidbody component to “Continuous”. Do that for the player only. This will have a negative impact on the performance, but it’ll be unnoticeable.

1 Like

Many thanks for you help! The player already had a rigidbody and Ive made the walls a bit bigger and made them static. I also made the rigidbody continuous. When the moveSpeed is higher than 10, it still goes through the walls. 10 still feels quite sluggish to me.

Its fixed! When I made all the objects smaller, it became less sluggish at 10 speed. Thank you for your help, Nina!

I’m glad you found a solution. Thanks for sharing it here. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms