Hi everyone,
I’m trying to make to spin one object while I press the mouse left button and drag. so in that way I can spin my 3d object.
But now my problem is that the mouse cursor interfere with my other buttons.
Please see this little short video, maybe I can explain better.
Also I want to enable my script inside the blue square showed in my screenshots.
Also I want to enable my script inside the blue square showed in my screenshots.
Now I’m using this script to rotate my object.
var rotationSpeed = 10;
var rotationStart = 0.0;
var rotatehome = false;
function Awake ()
{
transform.Rotate(rotationStart,0,0);
}
function Update ()
{
if (Input.GetButton("Fire1")){
rotatehome = false;
var foo : float = Input.GetAxis("Mouse X");
Debug.Log(foo);
transform.eulerAngles.y = (transform.eulerAngles.y - Input.GetAxis("Mouse X") * rotationSpeed);
Return();
}
else if (rotatehome)
{
transform.rotation = Quaternion.RotateTowards(transform.rotation, new Quaternion(0,0,0,0.1), rotationSpeed);
}
}
function Return()
{
yield WaitForSeconds (0.5);
rotatehome = true;
}
Thanks for your help!