- Home /
How to keep the orientation of an object unchanged when applying forces on its sphere collider?
I am new to Unity and still not familiarized with the concept of the orientation and collider of an object.
Basically, what I am trying to do is to apply a force ( using Rigidbody.AddForce() ) on a cylinder object. Instead of using mesh convex collider, I used capsule collider for the cylinder object. After that, I moved the capsule collider a little bit upwards, so the collider of the cylinder would not overlap with the collider of the ground.
However, when the game starts and the force is applied on the cylinder, the cylinder object starts to rotate with respect to the center of the collider when it is moving. It looks really weird since I do not want the cylinder to rotate while moving. I just want it to slip on the ground and slow down due to the drag.
I do it again with the sphere collider and the result is more or less the same. Is there any method to stop the rotation or keep the orientation of an object unchanged when applying forces on it?
Appreciate for any help. Sorry for any mistake on grammar since I am not a native speaker.
Answer by WisherHK · Jan 04, 2018 at 05:35 PM
The problem is solved. It can be done by freezing the rotation with respect to x-axis and z-axis.