[gameprogrammer] Re: Rotation, Rotation, Rotation...

  • From: Robbert de Groot <zekaric@xxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Tue, 18 Mar 2008 11:27:38 -0400 (EDT)

--- richard sabbarton <richard.sabbarton@xxxxxxxxx> wrote:
> I have been looking into this a bit further and I think I can
> describe
> the problem a little better. (maybe)...
> 
> OK.  What I want is to be able to rotate my Player view around my
> players axis and not the global axis.  So, if my player starts out,
> as
> is default, looking down the Z Axis and then looks down I want my
> players Z axis to point down so that a rotation around my players
> axis
> are relative to the player and not the global axis.
> 
> Lets say my control keys are up,down,left and right.  If my player
> pushes down by 90 deg and then pushes left by 90 deg I want my
> player
> to now be on its side looking 90 deg to the left of its original
> position.
> 
> Currently, pushing down for 90 deg looks down but then the left
> action
> rotates the view and I am still looking down.

This speeks to me that you are rotating 'left' around the original
axis and not the newly 90 degree altered axis.  

- At the start your player xyz is (1 0 0), (0 1 0) and (0 0 1).
- For the 90 degree down rotation you are rotating around the x which
is at the moment (1 0 0)
- After the 90 rotation your player xyz is (1 0 0), (0 0 1) and (0 -1
0)
- Note a proper left rotation will be around the new z (0 -1 0) but
it looks like you are still using the old z (0 0 1).  The new z will
give you the rotation you want.  The old z will give you the rotation
that you are getting.

From the sounds of it you don't need quaternions.  You just need to
keep an updated xyz for the player to properly rotate your players
perspective.


Robbert de Groot


      Be smarter than spam. See how smart SpamGuard is at giving junk email the 
boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to New 
Mail today or register for free at http://mail.yahoo.ca 

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: