Jump to content
• Advertisement

# Ship trajectories

This topic is 4821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi guys, I'm working on a StarFox-ish game for my Computer Graphics class. For the main ship, I keep a yaw, pitch, and roll. The ship constantly thrusts forward, and each frame I take the forward vector and multiply it by the appropriate rotation matrices to get it to move in the proper direction. Now let's say I have a second ship. The second ship also has the same basic properties. I want to take the second ship and have it 'track' the main ship in a dog-fight style fashion (ie, it will try to take an intersecting course to get a good shot at the main ship). My initial impulse is to take the first and second ship and calculate a normal given their trajectories and then calculate the angle between them, then gradually rotate the second ship so that it starts to 'chase' after the first. I'm not sure how to implement this solution, though, or even if it's a suitable solution. I was wondering if anyone had any insights, resources, etc, on this problem. Any help would be greatly appreciated. Cheers, --Brian

#### Share this post

##### Share on other sites
Advertisement
First of all, it's a bad idea to maintain a ship's trajectory as roll, pitch, and yaw. This seems like a good idea at first, but becomes extremely unwieldy when you need to progressively change the trajectory. I suggest storing the trajectory as a quaternion.

In any case, if you want the chase plane to try to turn towards the lead plane, first you need to figure out the vector from the chase plane to the lead plane. Then you need to figure out the current "forward" vector of the chase plane. You can use a PD-controller to figure out, based on these two vectors, how hard and in what direction to turn.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633409
• Total Posts
3011721
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!