- Home /
I can't make the Arm - Base rotate in Axis Y
Hello Everyone!
Im learning with this Robot Toy.... But I can't make the Arm-Base rotates in Axis "Y".... I didnt have problems with the other parts...I have several days trying to fix it, but I can't....I can't make it rotate in axis Y Any help please!
Here you can see the image.
Also if you want to see the file.
Thanks in advance
Here it is the script for the Arm-Base in green.
var gunSpeed : float = 40;
private var rotation : Quaternion = Quaternion.identity; private var left : Quaternion = Quaternion.AngleAxis(-90, Vector3.up); private var right : Quaternion = Quaternion.AngleAxis(90, Vector3.up);
function Start () { // This piece of code will allow you to remember the origin. rotation = transform.rotation; left = rotation left; right = rotation right; }
function Update () { var speed = gunSpeed * Time.deltaTime;
if(Input.GetKey("r"))
{
rotation = Quaternion.RotateTowards(rotation, left, speed);
}
if(Input.GetKey("y"))
{
rotation = Quaternion.RotateTowards(rotation, right, speed);
}
transform.rotation = rotation;
}
Can you edit your post and fix the code formatting? (Also, I'll go ahead and provide a link to your forum thread on the same subject, here: http://forum.unity3d.com/threads/73454-I-can%92t-make-the-Arm-Base-rotate-in-Axis-quot-Y-quot.)