Skip to main content
gamedev.net
🔒 Locked

Rotations ...

Started by dxAvatar Aug 5, 2001 at 1:10 PM 5 replies 450+ views
Original Post
dxAvatar
dxAvatar
Hi everyone I''ve got a problem with rotation matrices : (you''ll perhaps think that is very easy but i''m beginning with D3D so plz help me) I''ve made a sample which displays a cube : you can rotate it with keyboard keys but i''ve got a very big problem : If i rotate around an axis it''s okay but if i change of axis then the scene comes back to beginning ... Should i explain : i make a 45° rotation to my cube around Z axis that''s cool ... and then i want to make it rotate around Y axis and ... the cube undo the 45° Z rotation !!! Can you help me ? I can put on the forum the code but i''ll be in TurboPascal !!! Thanx for the one who ''ll help me And Bye everyone dxAvatar
Wierdo
Wierdo
I don''t really understand your question, but you need to multiply the matrices together to have them both work.







It''s like my grandfather used to say, "Never quote your elders."
It's like my grandfather used to say, "Never quote your elders."
dxAvatar
dxAvatar
The only problem is that in my version of DirectX(called DelphiX) we don''t have neither RotationYawPitchRoll nor Translation so it''s a bit harder to do this ...

in fact my code looks like that

with dxInput do // this is the dxInput object
Begin // in c begin = { and end = }
if isUp in states then// if the key up is pressed
Begin
Pitch := Pitch+0.01 ; // Pitch = Real
D3DUTILS.D3DUTIL_SETXROTATION(World, Pitch);
dxDraw1.D3DDEVICE7.SETTRANSFORM(D3DTRANSFORMSTATE_World, World);
end;

if isdown in states then// if the key down is pressed
Begin
Pitch := Pitch-0.01 ;
D3DUTILS.D3DUTIL_SETXROTATION(World, Pitch);
dxDraw1.D3DDEVICE7.SETTRANSFORM(D3DTRANSFORMSTATE_World, World);
end;

if isLeft in States then
Begin
Roll := Roll +0.01;
D3DUTILS.D3DUTIL_SETZRotation(World, Roll);
DxDraw1.D3DDEvice7.SEtTransform(D3DTRANSFORMSTATE_World,World);
End;

if isRight in States then
Begin
Roll := Roll-0.01;
D3DUTILS.D3DUTIL_SETZROTATION(World, Roll);
DxDraw1.D3DDEVICE7.SetTransform(D3DTRANSFORMSTATE_World,World);
end

same thing for YAW

etc ...

Can you help me somewhere ?
if you can''t understand the code i can put it in C

thanx a lots and bye

dxAvatar

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.