PDA

View Full Version : Pitch Question


nickyee
07-13-2004, 07:33 PM
I'm noticing that Pitch goes from 0 to 88..89..90 but then 89..88..87, so it's never more than abs(90). So there are two +80's and two -80's. How does it figure out what Pitch=80 is if there are two 80's?

We're trying to set head movement limits on a mimic script, and noticed this.

Nick

farshizzo
07-14-2004, 11:07 AM
Hi Nick,

Once the pitch goes past 90, the yaw and roll are flipped 180 degrees and the pitch starts decreasing. If you would prefer the pitch to keep increasing past 90 then you could manually calculate it. Here's some sample code:import math

look = viz.get(viz.VIEW_LOOK)
x = viz.Vector(look[0],0,look[2]).length()
if look[4] < 0:
x *= -1
y = -look[1]
pitch = viz.degrees(math.atan2(y,x))Hope this helps