1 Reply Latest reply on May 22, 2006 11:41 AM by James Newton, ACP

    How to rotate a sphere in 3D...

      hi guys, i just have a quick question today, i am making a game 3d game with a sphere.

      What i want to do is rotate the sphere through keyboard controls, i.e : left cursor key rotates the sphere left etc.

      I have added the controls to the scene using the following :

      on exitFrame me

      if keyPressed ("w") then sprite(1).member.model("GeoSphere").rotate(0,5,0)
      if keyPressed ("a") then sprite(1).member.model("GeoSphere").rotate(5,0,0)
      if keyPressed ("s") then sprite(1).member.model("GeoSphere").rotate(0,-5,0)
      if keyPressed ("d") then sprite(1).member.model("GeoSphere").rotate(-5,0,0)


      But the main problem i am having is that the sphere doesnt seem to rotate the same way after it has been rotated in a different direction. It's like the pivot point of rotation seems to remain in the same position in the sphere, and not get reset after the sphere has been initially rotated. So once it has been rotated, all of the other directions are messed up.

      Does anyone know a method to allow the sphere to rotate in the proper directions all of the time? i'm guessing it might have something to do with resetting an axis or vector point of rotation, but i don't know how to do it.

      Thanks in advance