- Home /
Avoid moving platform pushing falling object
I have an object with a Rigidbody2D affected by gravity, that falls on to platforms. The platforms are kinematic but can be moved left or right (I'm currently doing this with rigidbody2D.MovePosition in FixedUpdate). The problem is, if the platform is moved into the side of the falling object, the object will be pushed to the side (green path on image). Any ideas how to avoid the object being moved (keep the same x position) and block the platform movement?
Edit: To be clear, the object should also be able to land and stay on the platform and not move with the platform when it is moved (which works as it is now).
Use layers. Have the objects on specific layers and use the collision matrix to ignore collisions between those layers
Answer by haim96 · Jun 22, 2014 at 01:29 PM
well, you could change the collider to trigger and fire "onTriggerEnter2D" event to stop the platform movement...
in case that someone will ask, trigger is preferred so it wan't be effected by the platform movement and wan't be pushed by it.
Thanks! But the object should also be able to land and stay on the platform (sorry for being unclear on that), so changing it to a trigger wouldn't really work? $$anonymous$$aybe detecting a collision and doing something from there could somehow be useful though.
Your answer
Follow this Question
Related Questions
How do I make a rigidbody2d that doesn't do anything on collision? 1 Answer
Usegravity for unity2d? 0 Answers
How do I Spawn an Object on a Seafloor Randomly? 0 Answers
Kinematic rigidbody movement. 2 Answers
2D Player attracted to Planets 0 Answers