I'm new to pyglet, yet loving the experience thus far.

On my learning experience I tasked myself to draw a sprite in the
middle of the screen and have it rotate to where the mouse was
clicked.

The sprite was loaded, anchor points were set to the middle of the
window.I converted the x,y coordinates for the sprite into a vector
and the mouse click location into a vector and calculated the angle
between the two.

                    # Used Euclid.py for the vectors and normalization
                    Nv = math.degrees( MouseVector -
SpriteVector ).normalized()
                    angle = math.atan2(Nv.y,Nv.x)

The problem that took me a while to solve was dealing with the fact
the angle was always 90 degrees off. The only way I could get the
sprite to move the correct angle was to subtract it from 90, as the
angles were showing up 90 degrees off:

                   sprite.rotation(90 - angle)

Why does that occur?   The sprite always loads right side up (facing
north if the window).  Is it my math or maybe the angle which the
sprite's.

I appreciate another set of eyes.

Cheers,

Scott
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to