Game Development Reference
In-Depth Information
46.
47.
transform.rotation =
48.
Quaternion.Lerp(
49.
transform.rotation, //from
50.
originalRot, //to
51.
Time.deltaTime * 3);//amount
52.
53.
//If the object is too near, manually set original values,
54.
//and set returning to false
55.
floatremaining=
56.
Vector3.Distance(transform.position, originalPos);
57.
if(remaining < 0.01f){
58.
transform.position = originalPos;
59.
transform.rotation = originalRot;
60.
returning = false;
61.
}
62.
}
63.
}
64.
Listing 58: A script to reset the position and rotation of building blocks when space is pressed
Search WWH ::




Custom Search