I am trying to get a movie clip to rotate smoothly based on the mouse movement. I dont want its rotation to be based on the angle of the cursor to the object but instead no matter where mouse is in relation to mc, I want it to rotate based on the movement of the mouse. So if you move cursor clockwise the mc rotates clockwise.
Here is what i have so far
Anyone offer any advice to improve this as it doesnt really work?Code:if (objGame == undefined) { objGame = new Object(); objGame.lastX = _root._xmouse; objGame.lastY = _root._ymouse; objGame.lastRotation = 0; } this.onMouseMove = function() { if (_root._xmouse <> objGame.lastX or _root._ymouse <> objGame.lastY) { var xDiff = _root._xmouse - objGame.lastX; var yDiff = _root._ymouse - objGame.lastY; var numRotation = (Math.atan2(yDiff, xDiff)) * (180 / Math.PI); if (numRotation > objGame.lastRotation) { plane._rotation = plane._rotation + 10; } else if (numRotation < objGame.lastRotation) { plane._rotation = plane._rotation - 10; } objGame.lastRotation = numRotation; objGame.lastX = _root._xmouse; objGame.lastY = _root._ymouse; } };