Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Rotation
Topic Started: Feb 18 2006, 03:13 AM (169 Views)
Cel
Member Avatar
Brackenwood Heavyweight
I cant seem to make a object turn towards the mouse. :S

Any help would be nice.
Offline Profile Quote Post Goto Top
 
clayt
Member Avatar
I'm not crazy... ask my toaster!
u mean if u move your mouse then a part of the object follows it while rotating (pivot)
Offline Profile Quote Post Goto Top
 
Cel
Member Avatar
Brackenwood Heavyweight
Doesnt matter if it follows or not. I'm trying to make the object point at the mouse.
Offline Profile Quote Post Goto Top
 
clayt
Member Avatar
I'm not crazy... ask my toaster!
sorry i dont know....
Offline Profile Quote Post Goto Top
 
clayt
Member Avatar
I'm not crazy... ask my toaster!
wait...

i know how to make an object follow the mouse... if that is what you want?
Offline Profile Quote Post Goto Top
 
Mr. Jiggmin
Member Avatar
made of tulips
Code:
 

onMouseMove = function () {
//finds the x distance
xDist = some_mc._x-_xmouse;
//finds the y distance
yDist = some_mc._y-_ymouse;
//uses the distances to get an angle in radians
angleRad = Math.atan2(yDist, xDist);
//converts radians to degrees
angleDeg = angleRad*(180/Math.PI);
//sets the rotation of the movie clip to the angle we came up with
some_mc._rotation = angleDeg;
//draws the movie clip in its new angle
updateAfterEvent();
};
Offline Profile Quote Post Goto Top
 
Cel
Member Avatar
Brackenwood Heavyweight
Awesome. Thanks!
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Actionscript · Next Topic »
Add Reply