A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: Adjusting Angles of a Physics Engined object

Threaded View

  1. #2
    Senior Member
    Join Date
    Oct 2007
    Location
    Leeds, UK
    Posts
    118
    You want the gradient at any point of the curve traced by the shell as it zooms through the air.

    If it leaves the ground with horizontal velocity H, and vertical velocity V,
    then by my reckoning the angle you're looking for at any point on its trajectory is

    Code:
    Math.atan(V/H - g*x/Math.pow(H,2))
    where V,H are the initial velocities as already stated,
    g is the acceleration due to gravity (roughly 10 metres per second, per second)
    and x is the horizontal distance travelled since being fired.

    My guess is you're going to have to play around with the value you give g until you get something that 'looks right' but hopefully this will give you enough to make a start.

    EDIT: That's the angle between the trajectory and the horizontal by the way.
    Last edited by DiamondDog; 06-17-2008 at 01:13 PM.

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