- Home /
How to constrain 2D objects?
So I have an object with a 2D collider that, when collided with another object with a 2D collider and rigidbody2D, causes it to shift and rotate even though the object isn't supposed to move at all. How do I stop this?
Answer by EmpI · Dec 26, 2014 at 05:17 AM
Found the problem. I'm an idiot.
I have a script on my player object which sets the rotation of the object it's touching. Sadly, I completely forgot to eliminate the script when it failed to do what I needed it to, in addition to failing to add an if (other.gameobject.tag == specifictarget) line.
Apologies for wasting everyone's time.
Answer by Kiwasi · Dec 25, 2014 at 11:00 PM
Set the rigid body to isKinematic. This will tell the physics engine that you don't want it moved automatically.
Nope. Didn't do anything.
For the record, the objects that aren't supposed to move don't have rigidbodies. This used to not happen, but I figure I flipped a switch by accident. Any idea what could cause this?
Your answer
Follow this Question
Related Questions
Colliders not working when rotating 2 Answers
Adding boundaries to restrict rigidbody2D movement 1 Answer
2D Colliders aren't actually touching but they're behaving like they do? 0 Answers
Player appears on top of an Kinematic object or underneath it when walking forward. 0 Answers
How do I get collisions between Tilemap Collider 2d and a Kinematic Rigidbody 2d? 1 Answer