Daeva
Daeva

Reputation: 11

Strange behavior with collisions in unity

I have a gameobject player that has a character controller and a gameobject cube that has a rigidbody.

I'd like to make my character go through the cubes like a Trigger. Except that I want the cubes to keep their gravity and physics.

I did a little research and found Physics.IgnoreCollision or the layer collision matrix. Both methods work, I get through my cubes well, except that I have a weird behavior that makes me feel like I'm bumping into each one of them, so I find myself slowed down in my momentum...

Is there a solution to my problem?

Image to give context

Upvotes: 1

Views: 371

Answers (1)

Leoverload
Leoverload

Reputation: 1238

In the Unity menu bar, go to Edit > Project Settings, then select the Physics category to open the Physics window. You will find a Matrix and here you can uncheck the collision between 2 layers. If you put the cubes in a layer and the player in another layer and in the matrix you uncheck the box, cubes will maintain their properties and player will pass through them.

Upvotes: 1

Related Questions