ive got this problem, i know how to check the angle between my object and the mouse, but i dont know how to make it rotate slowly to it…
i tried this codes:
//first method:
onClipEvent (enterFrame) {
this._rotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI;
}
//(this one doesnt have slow movement, it was just to know my code was working to detect the mouse angle)
//second method:
onClipEvent (enterFrame) {
this.targetRotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI;
if (this.targetRotation-this._rotation>6) {
this._rotation += 6;
} else if (this.targetRotation-this._rotation<-6) {
this._rotation -= 6;
}
}
//third method:
onClipEvent (enterFrame) {
this.targetRotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI;
if ((this.targetRotation<0 ? this.targetRotation+360 : this.targetRotation)-this._rotation>6) {
this._rotation += 6;
} else if ((this.targetRotation<0 ? this.targetRotation+360 : this.targetRotation)-this._rotation<-6) {
this._rotation -= 6;
}
}
//fourth method:
onClipEvent (load) {
this.rot = this._rotation+360;
}
onClipEvent (enterFrame) {
this.targetRotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x))*180/Math.PI;
if (this.targetRotation+360-this.rot>6) {
this.rot += 6;
} else if (this.targetRotation+360-this.rot<-6) {
this.rot -= 6;
}
this._rotation = this.rot;
}
none of them worked
can somebody help me??