PDA

Click to See Complete Forum and Search --> : Rotation....



minger
04-04-2002, 02:38 PM
Hey, I have what should seem to be a simple problem. I made a movie that has a throwable object in it, that will bounce back off of the walls. Gravity is also thrown in there, and the ball will eventually stop at the bottom of the screen if left alone. My object is a gear. What I want it to do is to rotate according to the xvelocity. Before I go on I have to give credit to Bit-101, as it is more or less his tutorial that it's from.
Anyways, I want the gear to rotate in the direction that it's moving, and like I said, I would like it to be proportional to the actual speed. I have tried a to just add a little code to the ball. _rotation = xvel where xvel is obviously my xvelocity. For some reason that didn't work. All of my script is on the object, which just consists of three frames. The first is just variables for like the leftedge, rightedge, etc, initial velocities. The third is gotoandplay(2); and the second is where all of the script is. If you want to see the gear in action, go to: http://www.mime.eng.utoledo.edu/intro1.swf The gear that I am talking about is the first one that drops at the beginning. Note: you will need the Flash 6 Player to view it correctly.
Thanks in advance for any help

bit-101
04-04-2002, 04:01 PM
i think you are on the right track with

_rotation=xvel, but _rotation is just the degree at which the object is rotated. you want it to constantly change, so in the same way you would say:

_x+=xvel


say:

_rotation+=xvel

you may need to multiply xvel by some factor to get the rotation just right.

john_bws
04-15-2002, 12:14 AM
you are trying to solve for an objects angular velocity. to find the angular velocity of an object so that it rolls without slipping given its linear velocity and radius do this:

omega = v / r

omega is the angular velocity, v is the linear velocity, and r is the radius. elementary rotational kinematics.