- Home /
Rigidbody doesn't rotate after collision
I'm new to Unity physics and I've created a test scene where I have an object (a car model) with a collider and a rigidbody, and another object (an obstacle, also with a collider) positioned below the car (the latter hovers in the air at the start of the scene). The obstacle isn't placed centrally below the car but a little to the side so that when I play the scene and the car falls down it should collide with the obstacle, bounce off of it and rotate.
In fact, it does fall, it does bounce off (or at least slide on the side of the obstacle :P) but it never rotates (it's up vector stays up). I don't know why it works that way, probably I setup something wrongly. I've tried both box collider and mesh collider for the car object. The obstacle is unity primitive capsule.
You say the obstacle is placed a LITTLE to the side. Correct me if im wrong, but the car would not rotate if there is a surface lying directly below its center of mass. In other words, the obstacle would have to be a little more to the side. A picture of the setup would be helpful.
Answer by NPS · Dec 25, 2013 at 08:01 PM
Well, this is embarassing. I've just found out the culprit was my own script (it messed with the car's rotation). I'm posting this as an answer as this is what solved my problem (fixing the script) but I know it's just realizing my own mistake. :P
Thanks everyone for taking time to try to help me.
Answer by PlasmaByte · Dec 24, 2013 at 12:55 AM
Under the rigidbody component in the inspector you have the option to freeze rotation. Is this checked?
Answer by luckruns0ut · Dec 24, 2013 at 01:05 PM
I'm assuming this is because there is no physics material on either object so the rigidbody doesn't flip since there is little friction... Have you tried adding them?
Hadn't but have just now. After adding materials the friction
seems to do its job but other than that - no effect. The car still doesn't rotate. Should I post here a sample scene?
This helped me, the material had no friction, (only bounciness), thank you!