rotation's pivot

Started by
3 comments, last by repka3 14 years ago
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.
My dev blog: gameluna.blogspot.com
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.
My dev blog: gameluna.blogspot.com
Rotation matrices will rotate your object around the world origin. You want to translate the object to the centre, rotate, and translate back again.
[TheUnbeliever]
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 ?
My dev blog: gameluna.blogspot.com
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]
My dev blog: gameluna.blogspot.com

This topic is closed to new replies.

Advertisement