dx
and dy
are relative mouse movements in pixels.
# Apply a mouse movement (or similar) to the camera
#
# `dx` and `dy` are relative mouse movements in pixels.
fun turn(dx, dy: Float)
do
# Moving on x, turn around the y axis
yaw -= dx*sensitivity
pitch -= dy*sensitivity
# Protect rotation around then x axis for not falling on your back
pitch = pitch.min(pi/2.0)
pitch = pitch.max(-pi/2.0)
end
lib/gamnit/cameras.nit:72,2--84,4