- Home /
This question was
closed Jun 18, 2014 at 08:36 AM by
Graham-Dunnett for the following reason:
Duplicate Question
Question by
kamikadze1 · Jun 18, 2014 at 08:34 AM ·
rotationerrorcubebce0051
Why does my script gives an Error "Operator '*' cannot be used with a left hand side of type 'Object' and a right hand side of type 'float'." testing on Android?
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 = ...")
Comment
Follow this Question
Related Questions
Quaternion.Slerp problem 2 Answers
My Code that Works on an object's rotation doesn't work. 2 Answers
What's the matter with my Cube.fbx? 0 Answers