Results 1 to 2 of 2

Thread: 3D Cube rotationg unexpectedly on touch

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    4

    3D Cube rotationg unexpectedly on touch

    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 .. 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 plz help to rotate them correctly
    i could see many examples or applications with such problem there also ...

  2. #2
    Junior Member
    Join Date
    Aug 2010
    Posts
    4

    Re: 3D Cube rotationg unexpectedly on touch

    Hey i got the solution for that rotation problem i multiplied the modelview matrix with previous model view matrix so that the transformations will be with respect to default axes

Similar Threads

  1. Replies: 0
    Last Post: 02-20-2012, 05:31 AM
  2. Opengl es 2.0 touch rotation problem
    By bharathr88 in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 1
    Last Post: 07-12-2011, 10:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •