Jump to content
  • Advertisement
Sign in to follow this  
repka3

rotation's pivot

This topic is 3083 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 think i miss somethings about geometry pipeline. I can't understand why the rotation pivot of my object is a side. See this image for understand the question: pivot I load model in x format and then from gui i change mAngle of object, then:

//============================================
//World Matrix
	D3DXMATRIX matRot;
	D3DXMATRIX matRoty;
	D3DXMATRIX matTras;
	D3DXMATRIX matscaling;
	D3DXMatrixIdentity(&mWorldMat);
	D3DXMatrixRotationY(&matRoty,(D3DX_PI*3/2 - mAngle)+D3DX_PI);
	D3DXMatrixTranslation(&matTras,mPosW.x,mPosW.y,mPosW.z);
	D3DXMatrixScaling(&matscaling,           mModelScaling,mModelScaling,mModelScaling);

	mWorldMat=matscaling*matRoty*matTras;

After this i use a standard PhongLight shader. The question is: The model is modelled around 0 origin in 3ds , why the pivot of rotation is a side of this 3d Arc ? Hope someone can help me. Thx for your time.

Share this post


Link to post
Share on other sites
Advertisement
forgot about the line:
D3DXMatrixRotationY(&matRoty,(D3DX_PI*3/2 - mAngle)+D3DX_PI);

Just consider this like:
D3DXMatrixRotationY(&matRoty,mAngle);
The others arguments is for consider 90 degree north.

Thx again.

Share this post


Link to post
Share on other sites
Rotation matrices will rotate your object around the world origin. You want to translate the object to the centre, rotate, and translate back again.

Share this post


Link to post
Share on other sites
Quote:
Original post by TheUnbeliever
Rotation matrices will rotate your object around the world origin. You want to translate the object to the centre, rotate, and translate back again.


Yes but even if I use

mWorldMat=matRoty;

In this case there is no translation, only rotation and the rotation is about center of world, i got the same result.. Indeed in this example the translation matrix is an Identity, and following you is like translate to origin ,rotate and translate back again. Right ?

Share this post


Link to post
Share on other sites
ok nvm, that side is exacly the world origin. I can't understand why but this is.. I think a problem in the exporter or something like that.I just load the model and put on the world with all matrix identity and the origin is just that side.

Edit: I made a cube 10x10x10 where the center is exacly in the 0 origin of 3ds max, and everthings are ok.

Thx TheUnbeliever.

[Edited by - repka3 on April 10, 2010 6:48:31 PM]

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!