3d rotation

    Apr 23 2009 | 7:19 pm
    I want to be able to tilt a cube up and down while it is spinning.
    Using any object which takes a rotate or a rotatexyz message, this isn't possible as the axis move with the rotation. I want whatever face of the cube is facing the screen to always tilt up and down and I cant work it out for the life of me!
    Does anyone know where I can find out more about different ways of rotating 3d objects to help me work this out?
    Thanks, Matt

    • Apr 24 2009 | 9:13 am
      u should check out zachary seldess's work with open GL camera.http://www.zacharyseldess.com/z.glNav.html
    • Apr 25 2009 | 1:13 am
      Thanks for the mention, Justin.
      Matt, here's a patch to get you started. This is just one way to do it, and it won't necessarily work in all scenarios. The patch is a modified version of my z.glRotate abstraction. Hope it helps.
      best, Zachary
    • Apr 25 2009 | 2:57 pm
      Hi Zachary,
      Many thanks for that patch. That is the kind of outcome i need, however, unfortunately I can't be using the camera to achieve this effect because i will need several cubes all spinning at once on screen.
      If there is a way of offsetting the rotation point on a gridshape object i may be able to achieve it by rotating around the X axis with gridshape and around the Y axis with handle.. but I'm not sure if thats possible.
      I just find it hard to believe that there is no easy and quick solution to this!!
      -Matt J
    • Apr 25 2009 | 4:21 pm
      Hi Matt,
      How about this. Using jit.gl.sketch to rotate the object in it's own object space and in world space.
      best, Zachary
    • Apr 25 2009 | 6:08 pm
      Thats basically what i have at the moment. My problem is that if you rotate this cube in your patch around the x axis by 90 degrees, so the face that was originally at the top is now facing the camera, the cube is now turning around and staying on that same face rather than rotating left and right like i want it to be.
      At no point do i want the cube to be rotating in a way where it stays with one face pointing at the camera.
      Imagine you were controlling the X and Y rotation with the up/down and left/ right keys. The left right keys should always turn the cube left and right, regardless of its orientation.
      I think maybe resetting the axes in same way after each rotation message would work.. very confusing i know!
      Hope that makes sense and thankyou very much for your time.
    • Apr 25 2009 | 11:24 pm
      Hi Matt,
      No, it's not clear to me exactly what you want. Originally you said:
      "I want to be able to tilt a cube up and down while it is spinning."
      That's what that last patch does. I'm not clear on what you want, I guess. Please explain in detail what you want to see, for example, as you rotate a cube from 0 to 90 degrees in that last patch.
      best, Zachary