Jump to content

  • Log In with Google      Sign In   
  • Create Account


throwing something in a arche patern


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Anddos   Members   -  Reputation: 485

Like
0Likes
Like

Posted 01 September 2012 - 06:23 AM

I want to make grenade in my fps game, how do you make it go outwards in a arche...
:)

Sponsor:

#2 Jason Z   Crossbones+   -  Reputation: 4901

Like
0Likes
Like

Posted 02 September 2012 - 03:41 PM

It is typically done by using a rigid body dynamics simulation with either a physics engine, or possibly just a simplification of those equations.

#3 Tom KQT   Members   -  Reputation: 1554

Like
1Likes
Like

Posted 03 September 2012 - 01:39 AM

The arch trajectory is incredibly simple to programm (*), but things get MUCH more complicated when you want the grenade to properly collide with other static or even moving objects in your scene and bounce on contact. Then you really need some kind of physics engine (albeit a very simple one).

(*) 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.

Edited by Tom KQT, 03 September 2012 - 01:39 AM.


#4 Bacterius   Crossbones+   -  Reputation: 8474

Like
0Likes
Like

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. Haha sorry my bad, I thought you defined g as a scalar. I must be tired - mods feel free to delete this post.

Edited by Bacterius, 03 September 2012 - 07:24 AM.

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS