function DoRoll (aPoint, aAxis, aAngle, aDuration) {
var tSteps = Mathf.Ceil(aDuration * 30.0);
var tAngle = aAngle / tSteps;
var pos : Vector3; // declare variable to fix the y position
// Rotate the cube by the point, axis and angle
for (var i = 1; i <= tSteps; i++)
{
transform.RotateAround (aPoint, aAxis, tAngle);
yield WaitForSeconds(0.0033333);
}
// move the targetpoint to the center of the cube
transform.Find("targetpoint").position = transform.position;
// Make sure the y position is correct
pos = transform.position;
pos.y = startY;
transform.position = pos;
// Make sure the angles are snaping to 90 degrees.
var vec = transform.eulerAngles;
vec.x = Mathf.Round(vec.x / 90) * 90;
vec.y = Mathf.Round(vec.y / 90) * 90;
vec.z = Mathf.Round(vec.z / 90) * 90;
transform.eulerAngles = vec;
// The cube is stoped
ismoving = false;
}
**How to fix this error? Is it possible? Oh, and an Error is in line 3 (place where is written "var tSteps = ...")**
↧