- Home /
Resetting rigidbodies' transform values
I have rigidbodies connected together. Having moved them ingame, is there a simple way to reset their position ingame using a script?
All rigidbodies are children of each other, so rb1 = child of rb0 and rb1 = connected to rb0 and so on using joints.
Answer by FL · Jan 19, 2013 at 10:13 PM
private var originalPosition : Vector3;
function Awake(){
originalPosition = rigidbody.transform.position;
}
function ResetRigidbody(){
rigidbody.transform.position = originalPosition;
}
Calls ResetRigidbody()
BCE0022: Cannot convert 'UnityEngine.Transform' to 'UnityEngine.Vector3'. BCE0053: Property 'UnityEngine.Component.transform' is read only.
Your answer
Follow this Question
Related Questions
Moving object with transform.position ignore other objects even if they collided 1 Answer
Strange Physics being applied to objects issue. 1 Answer
Convex NonTrigger Mesh Collider + Rigidbody = weird transform position 0 Answers
Moving rigidbody inside moving object 0 Answers
problem with rigidbody.position 1 Answer