Hi,
I'm trying to solve the following problem, and I've run up against a gigantic wall.
You are given:
- Position and orientation of Objects A and B
- Speed of Object A
- Speed of a projectile
- The Yaw, Pitch, and Roll of Object A (note: this is not the instantaneous orientation, these values describe the motion of Object A, so every frame, you apply the Yaw Pitch and Roll to Object A and move it forward by its speed)
The question is: where do you aim so that a projectile fired from Object B will hit Object A?
If the motion is linear, I found this solution thanks to alvaro, which works great, but completely falls apart as soon as the motion is nonlinear.
Any ideas?
Thanks!
Target prediction for nonlinear motion
An object with a constant angular velocity traces out a circle. You can use the parametric equation of a circle instead of the parametric equation of a line, and do things pretty much the same from there.
I think Sneftel is correct.
You are trying to find the time at which the projectile will hit the target, which means solving this equation:
how_long_it_will_take_bullet_to_reach(future_position_of_target_at_time(t)) - t = 0
At t=0 the expression on the left is positive and, if the bullet is faster than the target, the expression will eventually become negative. You can use binary search or Newton-Raphson to find a solution of the equation numerically.
You are trying to find the time at which the projectile will hit the target, which means solving this equation:
how_long_it_will_take_bullet_to_reach(future_position_of_target_at_time(t)) - t = 0
At t=0 the expression on the left is positive and, if the bullet is faster than the target, the expression will eventually become negative. You can use binary search or Newton-Raphson to find a solution of the equation numerically.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement