- Home /
Is there a way to code a collider trigger to allow collision only up to the achor point of a game object?
Hey, I'm coding a 2D beat-em-up with Unity, and I've run into a problem.
The player at the moment is just a moving box collider, and when it moves, it collides with the top of the player's collider, which is supposed to happen, I guess.
I wanted to know if there was any way I could code a way to allow collision, until the anchor point of the game object tries to pass through, or some other work around?
Answer by iwaldrop · Jan 16, 2013 at 10:30 PM
The easiest thing would probably be to resize the collider to the extents that you actually want collisions to occur at. So if you desire some amount of overlap then shrink the collider to the extent that you wish the collision to occur at. Make sense?
If you need to register a collision at the extents displayed in the screenshot then, perhaps, two colliders would serve you well. One would be the physic collider while the other would simply be a trigger to capture collision data to process however you want.
Your answer
Follow this Question
Related Questions
2D Collision 1 Answer
How can I make a non-player character (rigidbody) move when they touch the ground? 1 Answer
OnTriggerEnter2D not Working 0 Answers
2D Polygon Convex Decomposition Code 1 Answer
How to detect collision with shaders? 0 Answers