- Home /
Can a collider be solid along one axis only?
Is it possible to have my player character with a rigidbody and boxcollider2D pass through blocks horizontally, but collide with the same blocks vertically (for example when landing on a block)?
Answer by Thygrrr · May 16 at 06:07 AM
This is not possible to do directly, but you can use triggers to emulate it one-way colliders.
In the OnTriggerStay2D event (and the enter and exit event), determine the relative velocity and direction of the player, then, if needed, enable another, solid collider. On the object instead.
Make the triggers slightly larger than the potentially solid parts of the object.
Answer by Mary023 · May 16 at 09:51 AM
In Unity3D, you need rigidbodies on GameObjects that use colliders, as they use physics. You don't need rigidbodies on static GameObjects because they don't use physics, though you still need to have at least one in the calculation. ConduentConnect.com
Your answer
Follow this Question
Related Questions
2D physics object acts weird when pressed into other physics object 0 Answers
How do i stop rigidbody2D bounce 1 Answer
How to check place on empty for placement polygon Rigidbody2d? 0 Answers
Workarounds for Higher Control When Using Physics2D? 0 Answers
Is this a correct way to have multiple different compound colliders in one gameobject? 1 Answer