Can a Mathematical Formula Predict Missile Collision in Computer Games?

  • Thread starter RagingPineapple
  • Start date
  • Tags
    Trigonometry
In summary, the conversation discusses the challenge of creating a missile pre-aim system for a computer game. One person has a working system that involves predicting the future positions of the target and the missile, but the other person suggests using a mathematical formula to determine the necessary angle for the missile to collide with the target. The possibility of using parabola segments and straight lines as an approximation is also mentioned.
  • #1
RagingPineapple
21
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
  • #2
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.
 

1. What is an odd trigonometry problem?

An odd trigonometry problem is a mathematical question that involves the use of trigonometric functions such as sine, cosine, and tangent, and the numbers in the problem are not evenly divisible by 2.

2. How do you solve an odd trigonometry problem?

To solve an odd trigonometry problem, you first need to identify the given information and what you are trying to find. Then, use the appropriate trigonometric function and any known relationships between the angles and sides to set up and solve the problem.

3. What are the common types of odd trigonometry problems?

Some common types of odd trigonometry problems include finding missing sides or angles in a right triangle, solving for trigonometric identities, and using trigonometric functions to model real-life situations, such as finding the height of a building.

4. What are some tips for solving odd trigonometry problems?

One tip for solving odd trigonometry problems is to draw a diagram to help visualize the problem. Another tip is to use the unit circle to help with trigonometric identities and values. It is also helpful to double-check your work and make sure your answer makes sense in the context of the problem.

5. Why is it important to understand odd trigonometry problems?

Understanding odd trigonometry problems is important because trigonometry is a fundamental branch of mathematics that is used in various fields such as engineering, physics, and astronomy. Odd trigonometry problems help develop problem-solving skills and the ability to think critically, which are essential for success in these fields and in everyday life.

Similar threads

Replies
9
Views
1K
  • Science Fiction and Fantasy Media
4
Replies
112
Views
14K
Replies
2
Views
3K
  • Introductory Physics Homework Help
Replies
4
Views
5K
  • STEM Educators and Teaching
Replies
4
Views
4K
  • Introductory Physics Homework Help
Replies
4
Views
6K
  • Calculus and Beyond Homework Help
Replies
4
Views
3K
  • Introductory Physics Homework Help
Replies
20
Views
3K
  • Introductory Physics Homework Help
Replies
6
Views
3K
Back
Top