SFML community forums

Help => General => Topic started by: dove96 on April 03, 2016, 10:06:38 pm

Title: How to make a bullet curve
Post by: dove96 on April 03, 2016, 10:06:38 pm
Hello c++&sfml gurus, i was just wondering if how would i make the bullet(artillery) of my tank curve?? i've been looking for clear explanations and tutorials for this but i haven't found any..
any suggestions please??

sorry if the question is too broad..
Title: Re: How to make a bullet curve
Post by: shadowmouse on April 03, 2016, 10:14:14 pm
Do you mean if you are viewing it side on and the curve is caused by gravity? if that is the case, horizontal velocity should stay constant or gradually decrease due to air resistance, while you need to apply a constant vertical deceleration. So store position, velocity and acceleration as 2d vectors and apply each dependent on how much time has passed.
Title: Re: How to make a bullet curve
Post by: dove96 on April 05, 2016, 01:03:42 pm
yes that is what i exactly mean..shadowmouse, i am really new to this, can you help me out to do this especially the coding? on what should be the attributes of the objects like for example the bullets and tanks. :),..

thank you for the valuable tip..
Title: Re: How to make a bullet curve
Post by: picnic on April 05, 2016, 02:17:34 pm
You might find this simple explanation of help:

http://freespace.virgin.net/hugo.elias/models/m_fall.htm

Just substitute the word 'bullet' for 'particle' :D
Title: Re: How to make a bullet curve
Post by: nicox11 on April 05, 2016, 02:21:20 pm
Since your question is vague, you can simply search for vague answer. You should look for gravity implementation in 2D games.

If you have existing code, it may be useful to show it to us to help you implementing your bullet physic.