Can a Mathematical Formula Predict Missile Collision in Computer Games?

  • Context: Undergrad 
  • Thread starter Thread starter RagingPineapple
  • Start date Start date
  • Tags Tags
    Trigonometry
Click For Summary
SUMMARY

The discussion focuses on developing a mathematical formula to predict missile collision in computer games, specifically for a pre-aim system similar to clay pigeon shooting. The current method involves calculating future positions of the missile and target to determine the firing angle. Participants suggest that a more efficient mathematical approach could utilize the known distances and angles to form a triangle, allowing for the calculation of the necessary firing angle and the feasibility of collision based on the speeds of both the missile and the target. The discussion emphasizes the importance of establishing a coordinate system and parameterizing motion for accurate predictions.

PREREQUISITES
  • Understanding of projectile motion principles
  • Familiarity with coordinate systems in 2D space
  • Knowledge of basic trigonometry and triangle properties
  • Experience with programming concepts for game development
NEXT STEPS
  • Research mathematical models for projectile motion in gaming
  • Learn about coordinate system setup for 2D simulations
  • Explore algorithms for collision detection in game physics
  • Investigate optimization techniques for real-time calculations in games
USEFUL FOR

Game developers, mathematicians interested in computational geometry, and anyone involved in designing targeting systems for simulations or video games will benefit from this discussion.

RagingPineapple
Messages
21
Reaction score
0
I've been given a problem by a chap on another forum, to do with making a computer game.

The guy wants a missile pre-aim system (a little like clay pigeon shooting), where the target's angle in degrees and speed in pixels-per-frame are used in conjunction with the missile's own speed to predict what angle the missile must fire at in order to collide with the target.

My system works, but it involves computing the future target and missile positions inside the missile (in its private variables) to find a point where the distances are close enough for a hit. Then it just finds the angle between those future positions and fires at that angle.


However, I was thinking, there must be some way to do it mathematically, surely?

Ultimately, at the end of the colision, we'll have a nice neat triangle. Before the missiles start moving, we already know the distance between the shooters (the adjacent), the angle of the target (angle between hyp. and adj.), and the lengths of the hypotenuse and opposite in relation to each other (the speed of the missile vs the speed of the target).

Using this data, could a mathematical formula more efficient than my 'process-of-prediction' be developed to determine:

- What angle the missile must fire at to colide with the target and therefore create a complete triangle.
- If, given the speeds of the missile and target, a colision is actually possible (if the target goes too fast at the wrong angle, it will be impossible for the missile to strike it).

Any thoughts, oh wise math people? :)
 
Mathematics news on Phys.org
If you want to do it right, then the sides of your triangle will be parabola segments. To calculate those, you need to know the initial velocity at which the target and the cannon ball moves, plus the angles. The formula can e.g. be found on Wikipedia: https://en.wikipedia.org/wiki/Projectile_motion

The assumption that the actual paths are straight lines makes it easier. It is probably a valid approximation in case of high speeds of both. The triangle is located in a plane. So I would first set up a coordinate system for this plane, e.g. with the target starting point as origin, calculate the equation of the plane, and then parameterize the motion (straight lines) with respect of time. This was you will have a framework to operate with.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 112 ·
4
Replies
112
Views
23K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K