- Home /
Collision Detection with edges of planes
So, we're making a 2D platformer that has a mechanic that requires us to use planes as our platforms. The planes have to be rotated so they are facing the screen(so player can see the image). The player is a rigidbody. And the platforms are planes with a mesh collider set to a plane. We are trying to get the player to collide with the edge of the plane, not with the one face that is collidable because that is facing towards the player so that they can see it. Normally in unity the plane is only collidable only on one face and you can pass through the plane from the other side and edges. And we want to be able to make those edges collide with the player. If anyone has any ideas it would be greatly appreciated, we are kinda at out whits end...
Answer by DaveA · Feb 28, 2013 at 03:19 AM
Why not just use boxes and box colliders? you see one side of the box, and player collides with the edges.
the reason we arent using box colliders is that we have a game mechanic that allows objects to be torn through and split into two different objects. And this code only works with plane mesh colliders.
What if your box collider were in a child object (no renderer)? It would do nothing but detect side collisions and inform the parent (plane). When torn, you can destroy that child, and/or create new ones for the torn bits? I'm not sure what your gameplay is like.
The issue is that our game requires detail down to the vertices level. Our $$anonymous$$r mechanic literally $$anonymous$$rs from vertice to vertice in an object.
Your answer
Follow this Question
Related Questions
Object following a path and colliding with other objects with physics. 1 Answer
How to use `Physics2D.IgnoreCollision()` to implement a one-way platform? 0 Answers
Moving a player smoothly without breaking collisions? 2 Answers
Having an array of points(vector2), how do I create a 2d terrain? (new to unity) 2 Answers