- Thread starter
- #1

Hi all,

I'm currently developing a game app, but I've hit a math problem, which I'm hoping someone here could help me with.

The problem:

This is a 2D board, which has cords (x,y).

I have a sub facing e.g. north, that firers a torpedo(moving e.g. 30) and the same direction as the sub. The target is a ship (moving at e.g. 7) moving left or right.

So the problem is how do I calculate a targeting calculation that measures the distance and time, as to when to fire a torp so that it will hit the ship from a distance.

Now keep this in mind, the ship will not always be at right angle. It is more likely that it will be at an odd angle...

I can safely say I had more hair before I hit this problem.

To round off what objects and values are used:

The angle, distance of the sub and the ship will always be different.

Have fun losing sleep, thanks to anyone and everyone that trys to help

DNA

I'm currently developing a game app, but I've hit a math problem, which I'm hoping someone here could help me with.

The problem:

This is a 2D board, which has cords (x,y).

I have a sub facing e.g. north, that firers a torpedo(moving e.g. 30) and the same direction as the sub. The target is a ship (moving at e.g. 7) moving left or right.

So the problem is how do I calculate a targeting calculation that measures the distance and time, as to when to fire a torp so that it will hit the ship from a distance.

Now keep this in mind, the ship will not always be at right angle. It is more likely that it will be at an odd angle...

I can safely say I had more hair before I hit this problem.

To round off what objects and values are used:

**1) Sub**(Location in x,y - Angle (0-360) facing);**2) Torpedo**(speed);**3) Ship**(Location in x,y - Angle travelling - Speed);The angle, distance of the sub and the ship will always be different.

Have fun losing sleep, thanks to anyone and everyone that trys to help

DNA

Last edited by a moderator: