Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBacterius

Posted 03 September 2012 - 07:24 AM

(*) All you need is your initial velocity vector v (magnitude = how strongly you throw; orientation = which direction and under what angle you throw), initial position vector p (the grenade position in the player's hand) and a constant gravity acceleration vector g. Then each frame you just update the velocity and position vectors:
v += g * dt
p += v * dt
where dt is the time span between frames and the operations are vector operations.

Gravity only affects the vertical component of velocity. Haha sorry my bad, I thought you defined g as a scalar. I must be tired - mods feel free to delete this post.

#1Bacterius

Posted 03 September 2012 - 07:18 AM

(*) All you need is your initial velocity vector v (magnitude = how strongly you throw; orientation = which direction and under what angle you throw), initial position vector p (the grenade position in the player's hand) and a constant gravity acceleration vector g. Then each frame you just update the velocity and position vectors:
v += g * dt
p += v * dt
where dt is the time span between frames and the operations are vector operations.

Gravity only affects the vertical component of velocity.

PARTNERS