A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Rotation....

  1. #1
    Senior Member
    Join Date
    Mar 2002
    Posts
    183
    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

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    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.

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    8
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center