- Home /
Is it ok to use transform.Rotate with a rigidbody that will use force also
I get the behavior I want from transform.rotate but I also want the behavior from addforce on the object also should I be using both on the same object ?
Answer by jdean300 · Jun 19, 2016 at 04:43 PM
If you use transform.rotate you can get into situations where two colliders are penetrating each other. The methods on transform do not check with the physics system and so will allow you to move objects in ways that a Rigidbody will not. Whether or not this is acceptable or if you should be doing this is up to you - just know the consequences (no collision check on transform movement).
Answer by scottishrob13 · Jun 19, 2016 at 06:47 PM
To get behavior similar to what you want, but still respect physics so you don't accidentally clip into any other objects, you may want to use rigidbody.MoveRotation instead. You'll have to change the format a little bit since transform.Rotate rotates by a certain amount, but rigidbody.MoveRotation sets the rotation as if you went transform.rotation = someRotation.
Your answer
Follow this Question
Related Questions
transform.forward not always forward? 2 Answers
Freeze (lock) FPS position while still able to 'look around' 0 Answers
Rigidbody.AddRelativeForce after modifying gameObject's rotation 1 Answer
How to detect right answer or not 0 Answers
how to use rigidbody.moveposition to go to an exact location 3 Answers