- Home /
Make characters go through each other
So I'm trying to make a Lemmings clone on my own and I managed to spawn the lemmings and make them walk but I have no idea what I could use to make them ignore the collision and go through each other when they meet, while also keeping the Rigidbody2D component so that they're affected by gravity. Any idea? Thank you very much.,So I'm trying to make a Lemmings clone on my own and I have no idea how to make the lemmings go through each other when they meet, while also keeping the Rigidbody2D component so that they're affected by gravity. Any idea? Thank you very much.
Take a look at layer based collision detection:
https://docs.unity3d.com/$$anonymous$$anual/LayerBasedCollision.html
You can effectively ignore layers
I put my lem$$anonymous$$gs on a Lem$$anonymous$$g layer and my blocks on a Block layer, and then I unchecked the Lem$$anonymous$$g/Lem$$anonymous$$g checkbox in the Physics section of the project settings and yet the Lem$$anonymous$$gs still interact with each other. Did I forget something?
Physics2D has a seperate settings and seperate layer collision matrix. Are you sure you changed it for 2D?
Answer by Subcreation · Dec 27, 2019 at 07:47 PM
Hello!
I loved Lemmings! It sounds like your Lemmings are all on the same Physics "Layer" and so they bump into each other. I would recommend making two different Physics layers: one for the environment, and one for the Lemmings. Once they are set up this way, you can disable collisions between Lemmings and other Lemmings but keep collisions between Lemmings and the environment.
To do this, click on each of the Lemmings (or the Lemming prefab, if you have one (you should definitely have one)), and put them on a Lemming layer by going to the top of the Inspector Panel where it says "Layer" and changing the layer/adding a new layer. Do the same with all the environment colliders (floor and walls etc.) but on a different layer.
Finally, go up to Edit->Project Settings and open the Physics entry and uncheck the box that sits in the Lemmings row and Lemmings column (this will make objects on the Lemmings layer not collide with other objects on the Lemmings layer).
For more information, look into Physics layers in Unity.
He’s already done this, but still having issues if you saw the comments
Your answer
Follow this Question
Related Questions
Projectile Ricochet Issue. Travels along the surface rather than reflecting off of it 2 Answers
Rigidbody Platform Character Movement 0 Answers
How can I make a non-player character (rigidbody) move when they touch the ground? 1 Answer
2D C# isometric Tile-based movement and collision problem 1 Answer