Hi, Just started using Unity as of yesterday and learning Java Script for the first time and have come up across my second problem.
I have modified some code and added a few bits of my own, which makes my model rotate by itself but when a mouse cursor hovers on and off it pauses the rotation.
My question is what code do i need to allow to make the model rotate with the cursor while grabbing it?
Here is my code that i have done to stop/start the rotation when hovering over the model and have tried to experiment to incorporate the rotating grabbing in the pause state but with no success.
var turnSpeed = 1.0;
var rotateObject = true;
function Update()
{
if(rotateObject) {
transform.eulerAngles.y += turnSpeed * turnSpeed * Time.deltaTime;
}
}
function OnMouseOver() {
rotateObject = false;
}
function OnMouseExit() {
rotateObject = true;
}
Would be grateful for any help. thanks.