• Advertisement
Sign in to follow this  

D3DXVec3TransformCoord Problem

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