Working on a simple(ish) projectile motion problem for a gaming program

AI Thread Summary
The discussion revolves around developing a projectile motion system in a Unity 3D game, focusing on calculating the interception of a projectile fired from a moving platform at a target. The user seeks guidance on extending a basic simulation to account for the complexities of relative motion, including the platform's movement and the target's trajectory. Key considerations include whether to approach the problem in two or three dimensions and the implications of constant velocity versus acceleration. Participants suggest using kinematic equations and relative position vectors to formulate the interception equations, emphasizing the simplicity of the problem in the absence of gravity. The conversation highlights the importance of accounting for multiple variables, including the velocities of both projectiles and the moving platform.
Jay123
Messages
3
Reaction score
0
Hello ladies and gentlemen I am working on a Unity 3d game project and I am in need of some physics guidance. You probably know Unity3d has a built in physics engine, and if you don't you do now. :)

I am determined to figure this out more or less on my own but I need some assistance with the mathematical reasoning.

In the past I used an website as guidance to implement a simple not-very-realistic simulation in Unity as proof of concept.

This is the website:

https://indyandyjones.wordpress.com/2010/04/08/intercepting-a-target-with-projectile/

However I would like help in extending this beyond simple physics to become a perfect interception formula.

Right now I am working to factor in the movement of the platform (with off-the-forward axis projectile shooting) performing the shoot down and the motion of the projectile to be fired at.

If you read the link provided you will understand how the author reasoned to a solution.

That is the part that I have trouble with. That, recalling all of my math education without resorting to my notes. I can do algebra just fine but Undergrad has been a real struggle. Its a long story. :)

So I just need some coaching about how to go about finding the intercept of a projectile fired from a moving platform at a missile (other projectile) flying in any direction near it (preferably within range and direction to intercept reliably).
 
Last edited by a moderator:
Physics news on Phys.org
Some details are unclear.
Is this in two dimensions or three? I expected three but the link describes the bullet as though moving in a plane: "The set of all possible positions that the bullet could be located at for any given time forms a circle around its original location". In 3D it forms a sphere around a point somewhat below its firing position.

What is the nature of the target's motion? Is that a constant velocity? If in 3D, is it not also subject to gravity?
 
  • Like
Likes Jay123
This is quite simple. Create a variable time defined as the time it takes for the ball to go up and then down in the y-direction. Use this variable to create a new variable about how far it goes in the x-direction on terms of the previous variable. You can have all kinds of variables depending upon what you want. Just slowly think it through and write down all the equations.

I'm sure you are aware of the kinematic equations. Is the question in 3d like @haruspex thought?
 
  • Like
Likes Jay123
Hey guys I've been asleep. Anyway in response to @haruspex those are good questions, something I forgot to provide initially.

For my first Unity demo I aimed to get it working in 2 dimensions, with constant, linear velocity. At some point I'd like to factor in acceleration, rotation, and right now: firing off axis from a moving platform (ie. the movement vector of my platform affects the shot trajectory due to inertia).

Oh and there is no gravity! I hadn't even thought of that but it may be a good future feature to work on. :)

I do not know of these kinematic equations tbph, I am not versed in physics which is why this seemingly simple problem is not getting easily solved by myself. I am a math minor, not a physics. :)
 
Jay123 said:
get it working in 2 dimensions
Easy. Work in terms of relative position.
The initial position of the target relative to the projectile is some vector ##\vec s##. If the target moves with velocity ##\vec u## and the projectile with velocity ##\vec v##, what is the relative position vector at time t?
For intercept, what equation can you write? Being a 2D vector equation it is effectively a pair of simultaneous equations. If you fix the magnitude of ##\vec v## the unknowns are the direction and the time.
 
  • Like
Likes lekh2003
This projectile problem is even simpler than before since not only is there no gravity, there is no acceleration altogether. I'm also assuming both projectiles move at the same speed. All of these facts make this problem phenomenally easy.

Assuming the above facts, the projecticles can only intersect each other at a point equidistant to the projectile launch points. So I thought up a few equations. Assuming that the trajectory of a projectile launched from coordinates (0, 0) is in the form ##y=mx##, then the trajectory of the intersecting projectile launched from coordinates (a, 0) is in the form ##y=-mx+am##.

Does that make sense?
 
haruspex said:
Easy. Work in terms of relative position.
The initial position of the target relative to the projectile is some vector ##\vec s##. If the target moves with velocity ##\vec u## and the projectile with velocity ##\vec v##, what is the relative position vector at time t?
For intercept, what equation can you write? Being a 2D vector equation it is effectively a pair of simultaneous equations. If you fix the magnitude of ##\vec v## the unknowns are the direction and the time.

Absolutely. Its just a line equation dependent on the time 't' with vectors for the position and velocity...
 
Jay123 said:
Absolutely. Its just a line equation dependent on the time 't' with vectors for the position and velocity...
Except, I forgot you have a moving platform, so you need another constant vector for that in the equation.
 
haruspex said:
Except, I forgot you have a moving platform, so you need another constant vector for that in the equation.
Yeah I seemed to have missed that too. I'm now assuming from OP's responses that the velocities are not the same. So that's just more variables, the more the merrier.
 
Back
Top