How to Calculate Projectile Direction and Timing to Hit a Moving Target?

  • Thread starter Thread starter E-Lo
  • Start date Start date
  • Tags Tags
    Projectile
Click For Summary

Homework Help Overview

The discussion revolves around calculating the projectile direction and timing to hit a moving target in a 3D game environment. Participants explore the implications of initial shot position, constant shot speed, initial target position, and constant target velocity without the influence of external forces like gravity or air resistance.

Discussion Character

  • Exploratory, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the necessary forces involved and question whether the scenario is in 2D or 3D. Some express uncertainty about how to adapt 2D collision principles to 3D. Others seek clarification on how to determine the angle and time for the projectile to hit the moving target.

Discussion Status

The conversation is ongoing, with various participants offering insights and raising questions about the setup. Some guidance has been provided regarding the equations of motion, but there is no consensus on how to apply them in the context of the problem.

Contextual Notes

Participants note that the scenario is set in a game environment, which simplifies some aspects by excluding external forces. However, there is still ambiguity regarding the 3D coordinate system and the direction of the target's velocity.

E-Lo
Messages
4
Reaction score
0
I'm having a hard time figuring out the best way to do this. Any insight would be appreciated since I'm not the greatest at math/physics.

I have an initial shot position, a constant shot speed, an initial target position, and a constant target velocity. I am trying to figure out the shot direction and at what time it would hit the target.

Fear not, this isn't homework, I've been out of school for quite some time now...I just want to figure this out.

Thanks in advance!
 
Physics news on Phys.org
What forces are involved? Gravity? Air resistance?

Are we in space? Will Gravitation be invovled?

Is this going to be in 3-D? 2-D?
 
Peter5897 said:
What forces are involved? Gravity? Air resistance?

Are we in space? Will Gravitation be invovled?

Is this going to be in 3-D? 2-D?


this is a game environment, so no other forces are involved and it is 3d
 
I could help you out with 2-D probably but I haven't delt with 3-D yet. I actually go to DigiPen Institute of Technology and I'm learning game programming.

I'm assuming everything would be the same except you would just add another axis into the equation but I'm unsure of how to find the collision data since I've only delt with collisions in 2-D using triginometry and basic projectille physics and I'm unsure of how to use sin, cos, tan in 3-D... I'm sure I had to do it in High School though.

If this is your first time programming a game I'd suggest working in 2-D to learn some basic collision stuff and then moving into 3-D.
 
I graduated from full sail in orlando about 6 mo ago. The collision data isn't what I'm trying to figure out, that part is easy. I just need to know how long it takes before the two collide and the direction the shot needs to be fired in for that to happen.
 
[tex]x_f=x_i+v*cosA*t[/tex]
[tex]y_f=y_i+v*sinA*t+1/2*g*t^2[/tex]
That is all you have to know. Where [tex]x_f[/tex] - final position, [tex]x_i[/tex] - initial position, A - angle with horizzontal axis, g = 9.81, v - velocity.
To deal with 3-D the projectile has to be poited in the target's direction.
 
Dmitri said:
[tex]x_f=x_i+v*cosA*t[/tex]
[tex]y_f=y_i+v*sinA*t+1/2*g*t^2[/tex]
That is all you have to know. Where [tex]x_f[/tex] - final position, [tex]x_i[/tex] - initial position, A - angle with horizzontal axis, g = 9.81, v - velocity.
To deal with 3-D the projectile has to be poited in the target's direction.
all that I am given is the initial shot position (sPos), a constant shot speed (sSpeed), an initial target position (tPos) and a constant target velocity (tVel). I'm not really sure how that would work with the formulas you just posted since I don't know what the angle would be. Maybe I'm missing something though.**Edit
There are also no forces applied, such as gravity or friction.
 
Last edited:
How are you supposed to hit a target without even knowing the direction of its velocity ? Is there a 3D coordinate system ?
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 53 ·
2
Replies
53
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
15
Views
3K
  • · Replies 44 ·
2
Replies
44
Views
5K
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K