Skip to main content
gamedev.net
🔒 Locked

3d vector problem

Started by bobbinus Apr 9, 2006 at 4:08 PM 3 replies 750+ views
Original Post
bobbinus
bobbinus
Hello A Fairly straightforward vextor problem I have never been quite sure of the best method: if I have a model and I want to have it facing a given direction what is the best way to perform the rotation? Rotating on x, y, z axes can be order dependant.. The example is for a missile shot from a helicopter, so that when fired it must match the forward facing direction of the helicopter.
Zakwayda
Zakwayda
Quote:
Original post by bobbinus
Hello

A Fairly straightforward vextor problem I have never been quite sure of the best method: if I have a model and I want to have it facing a given direction what is the best way to perform the rotation?

Rotating on x, y, z axes can be order dependant..

The example is for a missile shot from a helicopter, so that when fired it must match the forward facing direction of the helicopter.
For projectiles, you should just be able to initialize the orientation of the projectile as a copy of the orientation of the object firing it (the helicopter in your case); no rotations should be required.

As for the general problem of orientating one object toward another, there are a couple of different methods; which is most appropriate depends largely on whether your simulation has a global up (as would probably be the case with a helicopter sim) or not (as in a space combat game).
bobbinus
bobbinus
Thank you, Could you briefly elaborate on the 2 methods please :)
Zakwayda
Zakwayda
Quote:
Original post by bobbinus
Could you briefly elaborate on the 2 methods please :)
Here is the briefest of elaborations :-) In a 'fixed up' context, it's often sufficient to compute the target orientation from scratch using a pair of angles (you can think of it in terms of Euler angles, yaw and pitch, azimuth and elevation, or whatever). This would apply to, say, a helicopter, or a gun turret on a tank). The only failure case is when the target is directly above or below.

In a 6DOF (no fixed up) context, it's more difficult to construct an 'aim at' orientation from scratch. In these cases it's usually more effective to track the orientation from frame to frame, and perform relative rotations to turn the object toward the target.

If one or the other of these methods sounds like what you need, I can probably provide some more detail if necessary.
bobbinus
bobbinus
thanks again...I am using fixed up but just copying the orientation of the heli is the best here as you said... :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.