|
I am currently writing some logic that after the game has finished I want to reset all of our current game objects back to their starting locations. I can get the objects to get teleported back to their correct starting locations but it seems after the game countdown and I reenable their activity they will thrust forward. Or in what ever direction they were heading when I teleported it. Is there a way to clear an objects force? This is how I am teleporting my object.
(comments are locked)
|
|
To clear forces you need to set rigidbody.velocity and rigidbody.angularVelocity to zero. If you forget about angular velocity then objects will continue rotating. worked great thanks!
Oct 27 '11 at 04:33 PM
icetrap
(comments are locked)
|
|
You can use change your velocity with: rigidbody.velocity = Vector3.zero; But you might want to destroy and re-instantiate your object with: Destroy (gameObject); Instantiate (prefab, Vector3.zero, Quaternion.identity);
(comments are locked)
|
|
Do they have rigidbodies attached to them and are you manipulating their velocity/adding force to them in any way? If so, just set their velocity to Vector3.zero like so: rigidbody.velocity = Vector3.zero; If you're manipulating their position without use of rigidbodies, then it must have something to do with your system.
(comments are locked)
|
