# Help wanted on projectile equation for using in c++

Will anybody help me on doing or atleast giveme an equation of a projectile.
all i need to do is show the path of a projectile using graphics in turbo c++.
for this i need to have x and y values of the projectile... so i need an equation...
help wanted ...
i need to submit my project soon....

• : Will anybody help me on doing or atleast giveme an equation of a projectile.
: all i need to do is show the path of a projectile using graphics in turbo c++.
: for this i need to have x and y values of the projectile... so i need an equation...
: help wanted ...
: i need to submit my project soon....
:
:
:
This is how I would design the universe :-)

[code]
while universe still is{
for each object{
o.x += o.dx
o.y += o.dy
o.z += o.dz

o.dx += all forces that affect the x axis of this object
o.dy += the same with the y
o.dz += and z

draw(o) //ok, this wouldn't exist in the universe but it
//is required in computers
}
}
[/code]

If you want motion, init dx,dy,dz to the value you want.
If you want gravity, add it in the forces section
You don't need all the dimensions, if you're just going to program
on the screen then just discard z

Happy coding wishes
the one and only
[b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]

• [b][red]This message was edited by gautam at 2006-8-20 3:15:24[/red][/b][hr]
Hi,

Use the simple physics equations of motion in 2D dimensions.

s = ut + 0.5at*t
v = u + at
v*v = u*u + 2as

For projectiles make sure you take time into consideration or else you won't get the right physics results. So every time step like every second or millesecond you will get the distance to move in the next frame. And if you take a = -g(i.e -9.8 or approx -10 if working with integers) then you get the falling down effect.

: : Will anybody help me on doing or atleast giveme an equation of a projectile.
: : all i need to do is show the path of a projectile using graphics in turbo c++.
: : for this i need to have x and y values of the projectile... so i need an equation...
: : help wanted ...
: : i need to submit my project soon....
: :
: :
: :
: This is how I would design the universe :-)
:
: [code]
: while universe still is{
: for each object{
: o.x += o.dx
: o.y += o.dy
: o.z += o.dz
:
: o.dx += all forces that affect the x axis of this object
: o.dy += the same with the y
: o.dz += and z
:
: draw(o) //ok, this wouldn't exist in the universe but it
: //is required in computers
: }
: }
: [/code]
:
: If you want motion, init dx,dy,dz to the value you want.
: If you want gravity, add it in the forces section
: You don't need all the dimensions, if you're just going to program
: on the screen then just discard z
:
: Happy coding wishes
: the one and only
: [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]
:
:

• : [b][red]This message was edited by gautam at 2006-8-20 3:15:24[/red][/b][hr]
: Hi,
:
: Use the simple physics equations of motion in 2D dimensions.
:
: s = ut + 0.5at*t
: v = u + at
: v*v = u*u + 2as
:
: For projectiles make sure you take time into consideration or else you won't get the right physics results. So every time step like every second or millesecond you will get the distance to move in the next frame. And if you take a = -g(i.e -9.8 or approx -10 if working with integers) then you get the falling down effect.
:
:

Thanks, I didn't manage to get the time right before...
But one problem with it, since a proccessor doesn't work on time, it works on clocks, and the process shares clocks with other processes, it's impossible to determine a time step without wait...

What are v,a,t,s,u?
Are they velocity, acceleration, time and length respectivly?
And what is u then?

I find english math very confusing sometimes, becouse they have a lot of other names in my native language, swedish...
• : : [b][red]This message was edited by gautam at 2006-8-20 3:15:24[/red][/b][hr]
: : Hi,
: :
: : Use the simple physics equations of motion in 2D dimensions.
: :
: : s = ut + 0.5at*t
: : v = u + at
: : v*v = u*u + 2as
: :
: : For projectiles make sure you take time into consideration or else you won't get the right physics results. So every time step like every second or millesecond you will get the distance to move in the next frame. And if you take a = -g(i.e -9.8 or approx -10 if working with integers) then you get the falling down effect.
: :
: :
:
: Thanks, I didn't manage to get the time right before...
: But one problem with it, since a proccessor doesn't work on time, it works on clocks, and the process shares clocks with other processes, it's impossible to determine a time step without wait...
:
: What are v,a,t,s,u?
: Are they velocity, acceleration, time and length respectivly?
: And what is u then?
:
: I find english math very confusing sometimes, becouse they have a lot of other names in my native language, swedish...
:

ok.. the help was nice but i still dont know how to put it into a c++ program .... pls help
i want to show the motion of a projectile using a
c++ program

• : : : [b][red]This message was edited by gautam at 2006-8-20 3:15:24[/red][/b][hr]
: : : Hi,
: : :
: : : Use the simple physics equations of motion in 2D dimensions.
: : :
: : : s = ut + 0.5at*t
: : : v = u + at
: : : v*v = u*u + 2as
: : :
: : : For projectiles make sure you take time into consideration or else you won't get the right physics results. So every time step like every second or millesecond you will get the distance to move in the next frame. And if you take a = -g(i.e -9.8 or approx -10 if working with integers) then you get the falling down effect.
: : :
: : :
: :
: : Thanks, I didn't manage to get the time right before...
: : But one problem with it, since a proccessor doesn't work on time, it works on clocks, and the process shares clocks with other processes, it's impossible to determine a time step without wait...
: :
: : What are v,a,t,s,u?
: : Are they velocity, acceleration, time and length respectivly?
: : And what is u then?
: :
: : I find english math very confusing sometimes, becouse they have a lot of other names in my native language, swedish...
: :
:
:
: ok.. the help was nice but i still dont know how to put it into a c++ program .... pls help
: i want to show the motion of a projectile using a
: c++ program
:
:

Use my code, apply guatams forces, write your drawing routine and voila, your done.
• : : : : [b][red]This message was edited by gautam at 2006-8-20 3:15:24[/red][/b][hr]
: : : : Hi,
: : : :
: : : : Use the simple physics equations of motion in 2D dimensions.
: : : :
: : : : s = ut + 0.5at*t
: : : : v = u + at
: : : : v*v = u*u + 2as
: : : :
: : : : For projectiles make sure you take time into consideration or else you won't get the right physics results. So every time step like every second or millesecond you will get the distance to move in the next frame. And if you take a = -g(i.e -9.8 or approx -10 if working with integers) then you get the falling down effect.
: : : :
: : : :
: : :
: : : Thanks, I didn't manage to get the time right before...
: : : But one problem with it, since a proccessor doesn't work on time, it works on clocks, and the process shares clocks with other processes, it's impossible to determine a time step without wait...
: : :
: : : What are v,a,t,s,u?
: : : Are they velocity, acceleration, time and length respectivly?
: : : And what is u then?
: : :
: : : I find english math very confusing sometimes, becouse they have a lot of other names in my native language, swedish...
: : :
: :
: :
: : ok.. the help was nice but i still dont know how to put it into a c++ program .... pls help
: : i want to show the motion of a projectile using a
: : c++ program
: :
: :
:
: Use my code, apply guatams forces, write your drawing routine and voila, your done.
:
thank you .. all
my projects complete ...

• Here goes the explanation then (my physics is a little rusty) -
s = distance travelled
u = initial velocity
v = final velocity
a = acceleration which is -g(if gravity comes into play)

Time is the delta time (many times it is 0.016 which is 1/60 because of the 60 frames per second). You can also calculate this and then make use of it.

So if I have s = ut + 0.5at*t when I start -> on x-axis u = 0, t = 0.016, a = v(from v = u + at and t = 1sec), thus s = ut + 0.5vt*t. On the y-axis you take gravity and hence a = -g into account. It goes something like this.

: : [b][red]This message was edited by gautam at 2006-8-20 3:15:24[/red][/b][hr]
: : Hi,
: :
: : Use the simple physics equations of motion in 2D dimensions.
: :
: : s = ut + 0.5at*t
: : v = u + at
: : v*v = u*u + 2as
: :
: : For projectiles make sure you take time into consideration or else you won't get the right physics results. So every time step like every second or millesecond you will get the distance to move in the next frame. And if you take a = -g(i.e -9.8 or approx -10 if working with integers) then you get the falling down effect.
: :
: :
:
: Thanks, I didn't manage to get the time right before...
: But one problem with it, since a proccessor doesn't work on time, it works on clocks, and the process shares clocks with other processes, it's impossible to determine a time step without wait...
:
: What are v,a,t,s,u?
: Are they velocity, acceleration, time and length respectivly?
: And what is u then?
:
: I find english math very confusing sometimes, becouse they have a lot of other names in my native language, swedish...
:

• : Here goes the explanation then (my physics is a little rusty) -
: s = distance travelled
: u = initial velocity
: v = final velocity
: a = acceleration which is -g(if gravity comes into play)
:
: Time is the delta time (many times it is 0.016 which is 1/60 because of the 60 frames per second). You can also calculate this and then make use of it.
:
: So if I have s = ut + 0.5at*t when I start -> on x-axis u = 0, t = 0.016, a = v(from v = u + at and t = 1sec), thus s = ut + 0.5vt*t. On the y-axis you take gravity and hence a = -g into account. It goes something like this.
:
:
:
:
:

Thanks again, now I could actually make a real system that applies the real laws of physics in the right time.