#### Archived

This topic is now archived and is closed to further replies.

# controlling an object with vectors

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

## Recommended Posts

Okay so I have developed an object(airplane) but that doesnt matter. I record the x,y,z and its velocities the create vectors from that. I have to calculate the new x,y,z positions. I was thinking is it better to actual translate a vectore apply a movement vector to it, then grab the result x,y, and z? Which is the best(politically correct) way? thanks, nick

##### Share on other sites
Are you talking about translating a vector by a certain velocity vector? If so, it''s a little more complicated (but not very) than adding them together. Just run your velocity vector through D3DXTransformNormal(), and then add it to your position vector. Like this:
// posVec is the position vector// velVec is the velocity vector// matOrientation is the orientation matrix / inverse view matrixD3DXVec3TransformNormal( &velVec, &velVec, &matOrientationn );posVec += velVec;
To see an implementation of this, look at the UpdateCamera() function in the Cull sample.

Dustin Franklin
Mircrosoft DirectX MVP