- Home /
Can a ball rotate without moving and changing its axis?
I have a force applied to the center of the ball to keep it on the ground and I am currently using transform.Translate to move it. Can I freeze the axis so the "gravity" is still normal when I add force to the ball to rotate? Or can it be solved in another way?
Answer by JonPQ · Jan 27, 2018 at 01:37 AM
yep, just disable gravity, or freeze position and use RigidBody.AddTorque https://docs.unity3d.com/ScriptReference/Rigidbody.AddTorque.html
Its not good to mix transform.TRanslate with physics RigidBodies.... either use one or the other (manually moving it or using physics to move it)
I need gravity it keeps it grounded. For now I added another ball on this one, like a skin. And I made it a chiled to the main ball. And now I'm trying to rotate the skin relative to the main ball x axis. Do you know how to do this? $$anonymous$$aybe it's not good idea to mix it but for now I don't know how to move, rotate and keep it grounded on this kind of terrain. (maybe keep it grounded is the main problem) btw its a mobius strip
yes, as mentioned above, use addTorque ins$$anonymous$$d of addforce... torque is a rotational force. you can also set rigidbody constraints check boxes. to freeze the position in x,y and/or z (so you can turn off gravity and it will stay still) IF it needs to stay grounded...as in colliding with floor... try constraining x,z but not Y so gravity will still make it fall onto floor.
But I am not sure what will happen if you spin it with torque, but its still touching the floor.... probably the torque will win over friction and it will spin (if you add enough torque)
good luck