Imagination PowerVR SDK Blog

Translation


#1

I want to move a wheelchair with my keyboard. the right and left key for rotation and the down , up key for translation(advance and back)

the problem is when I rotate the wheelchair then i translated it for advancing , it is moved in inclined way

for example the initial position is in the center of home and its advanced vector is left to right if we rotate it 180° the advaced vector should be from right to left but form me it still left to right :frowning:

i hope that you understand my problem

please any idea?


#2

i am not sure i understand :slight_smile:

but if you are in the right coordinate system that should not happend, and when you say left to right around z or y axe ?

is the screen alreadyy rotated ? did you take that into account ?

bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);

because it will change the projection matrix

// Calculate the projection matrix

m_mProjection = PVRTMat4::PerspectiveFovRH(fFOV, (float)PVRShellGet(prefWidth)/(float)PVRShellGet(prefHeight), CAM_NEAR, CAM_FAR, PVRTMat4::OGL, bRotate);



then your world coordinate should be just rotated :

mWorld = PVRTMat4::RotationY(ANGLE)



regards

david





#3

in the begining the wheelchair was translated according to the Z axe then when I rotate it with angle =45° then I translated it, the correct answer is to consider this angle and advance but for me it was translated according to angle =0° (the initial position) i mean that it translate in inclined way