Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by Schlabbermampf

  1. Hi there! i am currently programming a rubiks cube for the playstation portable for my studies. so far it all works well except the rotation-control of the whole cube, so i'll explain it shortly: the analog stick gives his X coordinate to the rotation function which adds this value with a small multiplicator to the total rotation angle around the global Y axis. the same with the analog stick's Y coordinate that lets the cube rotate around the global X axis. to create the rotation matrix, the psp-api has a function sceGumRotateXYZ(float x, float y, float z) wich obviously uses euler angles.   so now my problem: the first rotation around the X-axis works well because the camera is fixed, but the second around the Y-axis rotates the cube around his local Y-axis, but i want it to rotate around the global Y-axis! for the first rotation it is similar if its around the global-world axis or the cube's local axis because they are the same, but for the second one the needed rotation-axis is transformed by the first one.   i don't know how to handle this situation. i just converted the Y-axis and the angle to euler angles with help of this article, but with the same fail-result. so i ask for your help.   greetings and best wishes fabian
  2. Schlabbermampf

    Combined Rotation around Global Axis

    HA! yes, nice, not this reversing of the rotation also makes sence! thank you so much!   and also you're really a wizard Álvaro, your code works perfectly in every letter :D (Gum stands for grafic unit matrix or so and provides functions for matrix handling on the psp)
  3. Schlabbermampf

    Combined Rotation around Global Axis

    thank you so far! i ditched eulers and this is what i tried:   sceGumLoadMatrix(&rotationMatrix); //load rotation matrix into "current"-register sceGumRotateX(analogMoveY); //changing cube's attitude by small rotations depending on user input sceGumRotateY(analogMoveX); sceGumStoreMatrix(&rotationMatrix); //store rotation for next use sceGumPushMatrix(); //push "current" matrix on matrix stack   i am not shure if this is what you meant, because the result has the reverse effect: the cube is always rotated in his local space and the controlling feels very confusing. thinking about it logically, the effect is also very predictable.
  4. Schlabbermampf

    Combined Rotation around Global Axis

    hehe, thanks :D okay, so here is the simple way i get (2) as code:   rotationAngle.y += analogStickX; rotationAngle.x += analogStickY; sceGumPushMatrix(); sceGumRotateX(rotationAngle.x); sceGumPushMatrix(); sceGumRotateY(rotationAngle.y);        this code has the same result so i think this funktion also do the same:   rotationAngle.y += analogStickX; rotationAngle.x += analogStickY; sceGumPushMatrix(); sceGumRotateXYZ(rotationAngle.x, rotationAngle.y, 0.0f);        by reversing the order i simply understand this (the effect is still equal, just that the Y rotation is global and the X rotation is in local space):   rotationAngle.y += analogStickX; rotationAngle.x += analogStickY; sceGumPushMatrix(); sceGumRotateY(rotationAngle.y); sceGumPushMatrix(); sceGumRotateX(rotationAngle.x);
  5. Schlabbermampf

    Combined Rotation around Global Axis

    okay, i painted an image and will try to explain: there is a coorinate system of the world in which the cube and the camera never change their position, i called it the global coordinate system. then there is the coordinate system of the cube, which natually rotates by the rotation of the cube. i want to rotate the cube along the global X and Y axis like a model viewer. so in the code, i used a rotationmatrix to rotate the cube around the first axis (image (1)). so now when i use a second rotation matrix, this one lets the cube move in his already transformed local coordinate system (image(2)). the desired rotation is orientated on the unchanged global coordinate system (image (3)). i think the second rotation in global like in (3), is a combination of two or three euler-angles in local space. i try the work with an algorithm that convertes an axis-angle rotation to euler-angles. first i rotate the cube in xAngle by eulerrotation. then i take the y-axis (0, 1, 0) and turn it the x-rotation backwards (0.0f, cos(-xAngle), -sin(-xAngle)) to get from this axis and the yAngle the euler-angles for the second rotation. but then the problem returns? for now i do not have any correct solution...i cant believe that this is so difficult...maybe there is an easy way?
  6. Schlabbermampf

    Combined Rotation around Global Axis

    no, the reversed order lets the cube rotate around the Y-axis correctly, but the X-rotation is in the cube's local not in the global coordinate system. in other words: the problem is also reversed xD
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!