Advertisement Jump to content
Sign in to follow this  

D3DXVec3TransformCoord Problem

This topic is 2492 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);

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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!