Sign in to follow this  

D3DMatrix Help

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this