Sign in to follow this  

World Matrix problems....

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

I want to perform a matrix rotation to one of my objects in the scene but cant differentiate the object from the whole world, everything rotates with the desired effect, not just the object i want. How do i perform this rotation only on the one object??? Very new to DirectX obviously, thanks in advance

Share this post


Link to post
Share on other sites
Setting a world matrix,( or any other setting, such as Render States and Texture Stage States) applies to anything drawn from when they are set to a value, until the value is modified. These settings can be modified mid-frame, to allow some of a scene to have certain settings, and the rest of the scene to have other settings.

What you're looking to doing is using 2 (or more) matrix settings for 2 parts of your scene.

Your rendering sequence should look something like this:

1) Set everything up like you currently do.
2) Set world matrix A for object #1.
3) Render object #1.
4) Set world matrix B for object #2.
5) Render object #2.
6) End the scene and present.

Remember, the matrix remains what you set it to until you call SetTransform again, with a different value.

Share this post


Link to post
Share on other sites
Cool, thats really helpful thanks.

one thing though...

I previously was not setting up a world matrix, presumed it was just defaulted to something. How will i get it back to this state?

Share this post


Link to post
Share on other sites
Just set it back to the identity matrix (Matrix.Identity in Managed DirectX), which will just keep the local objectspace coordinates for anything you render (i.e. your objects won't be tranformed).

Edited: really can't type :)

Share this post


Link to post
Share on other sites
If you don't specify a world matrix then it's set to Identity. So if you want to go back to the previous state then just make it Identity again.


D3DXMatrixIdentity(&MyWorldMatrix);
SetTransform(D3DTS_WORLDMATRIX, &MyWorldMatrix)


Edit: 'remigius' was faster :)

Share this post


Link to post
Share on other sites

This topic is 4354 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.

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