- Home /
Rigidbody (2D) stays in fixed angle even when colliding
I have a 2D rigidbody (the player) that reacts to collisions with both its normal velocity and angular velocity. So when hit by something it gets pushed back and will spin.
I also have a prefab 2D rigidbody that a bunch of get spawned and move toward the player colliding with them. But these other rigidbodies don't rotate at all, they're just constantly facing the angle I first set them to when they were spawned (the rotation code is in the Start function). I also haven't turned on fixed angle. And even when I remove the code component from a copy of the prefab it behaves the same so I must have botched a setting somewhere.
Any ideas what might be going wrong here?
Answer by SuperBiasedMan · Oct 31, 2014 at 02:13 PM
I discovered the problem. I used the LookAt function that rotated the object and made the circle collider rotate into the wrong plane, so even though it could still collide and have the movement affected, the actual rotations were happening in the wrong plane and I just couldn't see them because of the object's shape.
In short, don't use LookAt in a 2D game.
Your answer
Follow this Question
Related Questions
Problem with Rigidbody control script! (collision with perpendicular walls problem) 1 Answer
How can i make my RigidBodyFPSController to move when Is Kinematic is true ? 1 Answer
Player can't interact certain Rigid Body while another rigid body can. 0 Answers
Offsetting player position from a moving Rigidbody. 0 Answers
Change rigidbody transform without waking rigidbody? 0 Answers