- Home /
Rigidbody Disable Velocity/Movement?
I want to make a gameobject with a rigidbody able to rotate but not move. I've tried things like:
rigidbody.freezeRotation = false;
And
rigidbody.velocity = Vector3.zero;
but I don't really know how to do it. I guess I need to disable something bu I don't know what?
Answer by clunk47 · Feb 01, 2014 at 09:44 PM
I've seen those but what should I do? With Rigidbody.Contraints, what should I constraint? How do I uses Rigidbody.Sleep ()? I've used is$$anonymous$$inematic and it's not what I'm looking for.
I've linked you to the examples in Unity Script reference.
//Lock all axes movement and rotation
rigidbody.constraints = RigidbodyConstraints.FreezeAll;
//Unlock all
rigidbody.constraints = RigidbodyConstraints.None;
//Do the same as above, but w/ Sleep.
rigidbody.Sleep();
//Wake up
rigidbody.WakeUp();
When I used rigidbody.sleep() the player traveled upwards. Why? How can I stop this?
Your answer
Follow this Question
Related Questions
Preserving Velocity during rotations 1 Answer
Issue with an object rotating strangely 2 Answers
How to rotate the axis of a 3D GameObject 1 Answer
Rotation to rigidBody velocity 3D 1 Answer
Dragging object out of position 2 Answers