Jump to content
  • Advertisement

Archived

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

Red Planet

Player follow - Matrix question

This topic is 5215 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! I have 2 world matrix in object space: Object matrix and Player matrix. All matrixes containing position (._41 - ._43) and transform data. I like to transform Object to turn toward Player, but i don''t know how i do it. I used fTurn and fUp FLOAT values to transform like: D3DXQuaternionRotationYawPitchRoll(&qR, fTurn,fUp,0); D3DXMatrixRotationQuaternion(&matR,&qR); D3DXMatrixTranslation(&matT,vVelocity.x,vVelocity.y,vVelocity.z); D3DXMatrixMultiply(&matPosition, &matR, &matPosition); D3DXMatrixMultiply(&matPosition, &matT, &matPosition); Anybody know how i compute fTurn and fUp values? Thx.

Share this post


Link to post
Share on other sites
Advertisement
Last night i thinking about, and i''m going this way:

v1 = (matObject._41,matObject._42,matObject._43);
v2 = (matPlayer._41,matPlayer._42,matPlayer._43);
vDif = v2 - v1;
normalize vDif, and i saw parallel with matObject vDir
vector, which i gave from matObject._31,.32,.33

vDif.x -- matObject._31
vDif.y -- matObject._32
vDif.z -- matObject._33

if vDif values approaching the vDir values the Object is turning
toward the Player. But i''m doing it manual, how can i compute?




Share this post


Link to post
Share on other sites

  • Advertisement
×

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!