Question Do planes and cubes interact with other rigid bodies in the same way?

Discussion in 'Physics' started by Jayjayfast, Oct 3, 2023.

1. Jayjayfast

Joined:
Sep 12, 2023
Posts:
28
So,

I know this is such a beginner question.

To give context, I've spent the last few days practicing with shaders and materials. I have build a 3D internal structure, out of planes, that I am very happy with. But, when I've inputted my player's placeholder, currently a 3d capsule, it passes through the planes.

Both the capsule, and the planes, all have both rigid bodies and colliders attached.

Neither has kinetic or gravity ticked.

I am using .MovePosition to move the placeholder's rigid body.

Now, do I have to start again and replace my planes with cubes, or is there another armature mistake I could be making?

2. arkano22

Joined:
Sep 20, 2012
Posts:
1,841

Planes are infinitely thin. Cubes are not.

This means that it's easier to pass trough a plane than it is to pass trough a cube. If your character moves fast enough for its collider to move to the other side of the plane in a single frame, then no collision detection will take place. This common effect in all game engines is called tunneling, and is a consequence of how computers treat quantities in a discrete (as opposed to continous) way.

You might want to use continuous collision detection.

3. Jayjayfast

Joined:
Sep 12, 2023
Posts:
28

I had a feeling that is was going to be something like that.

I think I'm just going to have to rebuild my house, out of bricks this time, I guess.

4. Jayjayfast

Joined:
Sep 12, 2023
Posts:
28
For what its worth the continuous collision detection did work, to a point, but only if I reduced the speed of the player sufficiently.

It will be better in the long run to start over and do it with thicker walls.

Thanks again

Unity Technologies

Joined:
May 24, 2013
Posts:
11,105
If this is a Dynamic body (presumably what you meant when you said not "kinetic" (Kinematic?) then you shouldn't really be using a Kinematic movement on it. In 3D physics "MovePosition" and "MoveRotation" cause a Dynamic body to instantly be repositioned at the specified position. You should be using forces or velocity for move Dynamic bodies. Then you'll find continuous works.