Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xeno

Changing origin

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

Hi! i working with D3DIM and i want to know how can i change the origin of an object? lets say create a cube between (-1,-1,-1) to (1,1,1) so its origin is in (0,0,0) , now i want to change the cube origin lets say to (2,4,5) without moving the cube (i want the cube to stay in (-1,-1,-1) to (1,1,1)) , how i do it? Thanks . Posted By Xeno. Kobe Bryant - "Just believe in yourself"

Share this post


Link to post
Share on other sites
Advertisement
hmmmmm.... somebody?


Posted By Xeno.
Kobe Bryant - "Just believe in yourself"

Share this post


Link to post
Share on other sites
Hi Xeno,

I think you need to clarify what exactly it is you want. You say you want to move the origin of the cube from (0,0,0) to (2,4,5) yet you don''t want to move the cube. Well that is impossible.

I assume that what you really wanted to say is that you have a cube defined between (-1,-1,-1) and (1,1,1), and now you want to place it in the world so it is centered around (2,4,5). To do this you should set the world matrix to a translation matrix that translates with (2,4,5), like this:

D3DXMATRIX T;
D3DXMatrixTranslation(&T,2,4,5);
pD3DDev->SetTransform(D3DTRANSFORMSTATE_WORLD, (D3DMATRIX*)&T);

When you render the cube after that it will be centered around (2,4,5) without changing your original vertex data.

If this wasn''t what you meant, then please tell me so.

- WitchLord

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!