Hi, I’m working on a game project. Character objects have rigidbody + capsule collider. They move with velocity, but I don’t want them to push each other. Just like in this video
the ways I tried so far:
giving “.isKinematic = true” to objects when they collide (OnCollisionEnter)
changed enemy characters’ rigidbody mass. with this way player can’t push its enemies but enemies can
@omermecitoglu Can u explain how this solved it for you? Wouldn’t ignore collision just make them pass right through each other as if they were non-existent?
Sorry to necropost, but after fiddling with this problem for a good 3 hours I figured out what the other thread meant and it works perfectly. So what I did was I had a parent object with a non-trigger collider and a dynamic rigidbody. I then added a child to this object with a non-triggercollider that is slightly larger than the parent collider and added a kinetic rigidbody to the child object. In order for the parent and child non-trigger colliders to no collide, you set IgnoreCollision(parentcollider, childcollider) in a start method.
The behavior of multiple objects with this setup is that they no longer push eachother, since when one object tries to push the other, he will enter the kinetic collider of the other with his own dynamic collider, which it cant push and vice versa. I hope this clears things up for you.
Thanks for sharing. Yeah we solved it exactly like this back then, but never shared it here. But good you did for other people that stumble across this in the future. It’s actually super simple, but it took me a good time to figure it out. Our exact solution (maybe it’s helpful for others):
First collider:
Second collider (child object of Player): Only let this collider collide with objects of layer Player
To prevent it from colliding with it’s own playerblocker: