• 13
• 16
• 27
• 9
• 9

# rotation's pivot

This topic is 2899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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: 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 on other sites
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 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 on other sites
Quote:
 Original post by TheUnbelieverRotation 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 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]