Jump to content
  • Advertisement
Sign in to follow this  
ChrisMelling

D3DXVec3TransformCoord Problem

This topic is 2427 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

Good evening everyone,

I have a light object in my engine and it takes a D3DXVECTOR3 as the direction of the light. Instead of the direction being stuck facing one direction I wanted it to use the rotation of my player and follow the rotation of the player, here is the piece of code I used.

D3DXMATRIX meshRotation;
D3DXMatrixRotationYawPitchRoll (&meshRotation, player->GetRotation().x, 0, 0);
D3DXVec3TransformCoord(&light->dir,&light->dir,&meshRotation);

I'm unsure if I'm using this incorrect, please tell me if I am, but when I run it in-game it behaves very strangely, instead of just moving with the player, it instead spins very rapidly around the player in the direction they have just turned. Below is a video of what is going on ingame,




Should I only be running this when the player change its rotation? Or should it just not be in the update method at all?

Thanks, chris.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!