I want to reset the rotation of an object once it reaches a specific coordinate on the z axis…
I have this which works fine at the moment…
var target : GameObject;
function Start () {
}
function Update () {
if(transform.position.z == -1.0f)
target.transform.rotation = Quaternion.identity;
}
However instead of the reset being an instant change, is there a way of adjusting the script so that the object actually rotates back to the points of 0,0,0 instead of instantly reverting to 0,0,0?
Please use Quaternion.Lerp as described here: in the documentation, where target Rotation will be Quaternion.identity. I hope this is what you’re looking for.