Basic Projectile Physics

  • #1
I'm trying to simulate a projectile launch like this ( http://galileo.phys.virginia.edu/classes/109N/more_stuff/Applets/ProjectileMotion/jarapplet.html ). I googled but the results aren't specific.

What would you set the x and y of an object when time ( t ) is updated, assuming you have these vars:

* angle ( a )
* velocity ( v )
* x0 ( initial x )
* y0 (initial y)
* Not sure if necessary, but if so gravity (g)

_____________________

Also, given a projectile at its initial position'(x0, y0) and angle 'a', how can I solve for the velocity (v) to make it pass through a point (x, y)?

Thanks.
 

Answers and Replies

  • #3
378
2
I'm trying to simulate a projectile launch like this ( http://galileo.phys.virginia.edu/classes/109N/more_stuff/Applets/ProjectileMotion/jarapplet.html ). I googled but the results aren't specific.

What would you set the x and y of an object when time ( t ) is updated, assuming you have these vars:

* angle ( a )
* velocity ( v )
* x0 ( initial x )
* y0 (initial y)
* Not sure if necessary, but if so gravity (g)

_____________________

Also, given a projectile at its initial position'(x0, y0) and angle 'a', how can I solve for the velocity (v) to make it pass through a point (x, y)?

Thanks.
you need to know vectors, in order to make those like simulations.
you making it in java?!
I would be interested working *against* you! -- don't have anything else to do
 
Last edited:
  • #4
Welcome to the forums!

Check out Motion3c.pdf in the following link. That should help getting you thinking in the right direction.

https://www.physicsforums.com/showthread.php?t=93670
Thanks for the link. This is for computer programming by the way, not a physics course. :)

So is this it then?

x = vel*cos(θ)*t
y = -½ g*t^2 + vel*sin(θ)*t

Any idea of a formula for finding the second part?

Thanks!
you making it in java?!
I would be interested working along with you! -- don't have anything else to do
Thanks for the offer, but I just need to find this one thing and then apply it to a bigger school project I am working on. :)
 
  • #6
378
2
for the second part, you need to solve your parabolic equation, i guess.

so make it like y=..x

and then solve it
 
  • #7
Don't have time to open your project right now, but Ill take a look at it later.

>>What's the project about?

It's a 2D platformer that resembles gameplay similar to sonic. It's beign developed in both Java (as an applet) and Flash (ActionScript 3, as a swf).

__________

Okay the projectile launch seems pretty realistic. Here's how I have it:

int xzero = obj.x;
int yzero = obj.y;
int t = 0;
int vel = 100;
int theta = 45;

On thread call (every 1/35 of a second):

t += 1/35;
obj.x = vel*Math.cos(theta*(Math.PI/180))*t+xzero;
obj.y = 16*t*t -vel*t*Math.sin(theta*Math.PI/180)+yzero;

But now I'd like to calculate the velocity required to hit point x2,y2 from initial point xzero, yzero with angle 45. How would I do this?

Appreciate all the help.
 
  • #8
378
2
in that original equation,
first isolate t in the x equation {x = x0 + vel*cos(θ)*t}

and substitute t value into the y equation
and then you can isolate v..
 
  • #9
in that original equation,
first isolate t in the x equation {x = x0 + vel*cos(θ)*t}

and substitute t value into the y equation
and then you can isolate v..
I'm a little confused. If I were to do that (isolate velocity in the obj.y assignment), I'd need to know what the obj.y equals, and to calculate that I need the velocity, so it's like an endless loop.
 
  • #10
378
2
no y equals to y2
and x equals to x2,
in those equations
 
  • #11
Oh, of course, that's genius! Ill try it out. :)
 
  • #12
378
2
I guess you would also need mathematical co-ordinates, as computer screen is in pixels lol

>(evil smile)<
 
  • #13
Okay I got this far:

x = x0 + vel * cos(ang)*t
t = x/x0 + vel * cos(ang)
y = y0 + 16 * t^2 - vel * t * sin(ang)
y = y0 + 16 * (x/x0 + vel * cos(ang))^2 - vel * (x/x0 + vel * cos(ang)) * sin(ang)
vel = ?

Now I need to isolate vel, but I'm not sure exactly how.
 
  • #14
378
2
just a sec.

if you are free, can you define what you are trying to do here?
because I might help you coming up with an alternative solution
 
Last edited:
  • #15
378
2
[tex]\left| x\right| \,\sqrt{\frac{g}{x-y}}[/tex]

or, substitude x-x0 for x, if you want from x0,y0 point; also add "y0" to the y equation

P.S. check this for like two cases
 
Last edited:

Related Threads on Basic Projectile Physics

Replies
3
Views
2K
Replies
2
Views
604
  • Last Post
Replies
1
Views
1K
  • Last Post
2
Replies
40
Views
4K
Replies
1
Views
2K
Replies
4
Views
1K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
3
Views
4K
  • Last Post
Replies
7
Views
6K
  • Last Post
Replies
3
Views
1K
Top