gamnit :: EulerCamera :: reset_height
height
world units are visible on the y axis at z=0By default, height
is set to display.height
.
After the reset, the camera sits on the Z axis and rotation values are reset to 0. The X axis is horizontal on the screen and the Y axis is vertical. Higher values on the Z axis are closer to the camera.
# Reset the camera position so that `height` world units are visible on the y axis at z=0
#
# By default, `height` is set to `display.height`.
#
# After the reset, the camera sits on the Z axis and rotation values are reset to 0.
# The X axis is horizontal on the screen and the Y axis is vertical.
# Higher values on the Z axis are closer to the camera.
fun reset_height(height: nullable Float)
do
if height == null then height = display.height.to_f
var opp = height / 2.0
var angle = field_of_view_y / 2.0
var adj = opp / angle.tan
position.x = 0.0
position.y = 0.0
position.z = adj
pitch = 0.0
yaw = 0.0
roll = 0.0
end
lib/gamnit/cameras.nit:142,2--164,4