Jump to content
  • Advertisement
Sign in to follow this  

D3DMatrix Help

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

Does DirectX 9 have a Transform based on a sine wave? I have been looking through the SDK help but cannot see one. If not is there a simple way to make a transform using a sine wave? I am looking for a simple way just to move an object from one side of the screen to the other along a smooth sine wave path. Thanks for looking.

Share this post

Link to post
Share on other sites
You could do this using some simple math. Your world transformation matrix places the object in the world. It has position data that you can manipulate.
If you want to move your object along a sine wave you could easily do something like this

D3DXVECTOR3 position;
//using some sine wave alorithm
//i.e. y = sin(x)
//you can easily use this algorithm to get x and y coordinates.
D3DXMatrix matWorld;
D3DXMATRIXTranslation(&matWorld, position.x, position.y, position.z);
pDevice->SetTransform(D3DTS_WORLDMATRIX, &matWorld);
//render your object here.

I hope this helps.
Take care.

Share this post

Link to post
Share on other sites
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!