Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to make a bullet curve  (Read 3151 times)

0 Members and 1 Guest are viewing this topic.

dove96

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
How to make a bullet curve
« 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..
-dove96-

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: How to make a bullet curve
« Reply #1 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.

dove96

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: How to make a bullet curve
« Reply #2 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..
-dove96-

picnic

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How to make a bullet curve
« Reply #3 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

nicox11

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: How to make a bullet curve
« Reply #4 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.

 

anything