Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A question for a flash game

  1. Feb 26, 2009 #1
    i have any idea in physics 'i'm a game programmer who needs help
    i have this flash file
    the original idea is that i can click any opint on any shape and it'd move
    as in the flash exmple

    i have no idea what is the name of this physics action
    does any one know ?
    or more importent - where i can find a formula that can teach me how to do this?
    Last edited by a moderator: Apr 24, 2017
  2. jcsd
  3. Feb 27, 2009 #2
    Part of the answer is in your example. The small gray dots outside of the shapes represent the center of mass of the shapes. As you drag the object, the line between the point clicked on and the point representing the center of mass tends to line up in the direction you are dragging.

    To program it, make the object rotate about the (moving) drag point in the closest direction to make the points line up in the direction you are dragging it. The rotational velocity depends on the drag velocity: the faster you drag it, the faster it rotates.

    It's a bit easier to understand if you just forget about the shape and picture a straight line between the drag point and the center of mass that's rotating through the smallest angle possible to match the direction in which you are dragging.
  4. Mar 10, 2009 #3
    Thanks - but the idea is that i want to able to clikc and drag and point of the shape
    do you have a resource for a formula that solve the problem i have
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook