Hi everyone ,im new to this forum

hey buddies i am facing diffculty in solving some issues related to cube transformations

Im trying to rotate a 3D cube on touch. the distance moved to left or right is taken as the angle of rotation with respect to Y axis and the distance moved to up or down is taken as the angle of rotation with respect to X axis .

So these are the rotations im making

glrotate(angleXdistance, 0, 1, 0); // with respect to Y axis

glrotate(angleYdistance, 1, 0, 0); // with respect to X axis

so every time i add the angles with previous angles lik angleXdiatance + = angleXdiatance; in touch event

so the problem im facing is :

1.) when i rotate to right or left for 90 degree it rotates corectly ,and after when i rotate to up or down it rotates with respect to Z axis instead of Y axis

2.)when i rotate to right or left for 180 degree it rotates corectly ,and after when i rotate to up it rotates

down , to say in it rotates in opposite direction .

i could analyse that after 90/180 degree roataions the default axes changes , so it will roatate with respect to current axes , so i tried to chk the condition if it crosses 90 thn instead of rotating with respect to X rotate with respect to Z , and after 180 , reverse the rotation angle sign â€¦ it works but nt always :evil: â€¦ sm prblm occurs in sm other condition,

so i found out all posibilities , at certain angle of rotation , these are the current axes and thn passes those axes but still din work coz two rotations are happening so tht the number of possiblities increaes which is nt possible to find all conditionsâ€¦

so if anyone has idea how to solve this issue plz help â€¦ my cube and my head rotating unexpectedly :shock: plz help to rotate them correctly :roll:

i could see many examples or applications with such problem there also â€¦