#App Touchscreen Cam Rotation ...

2 messages · Page 1 of 1 (latest)

rigid halo
#

To build an app, I tried to put the Mousemotion Cam control on touchscreen buttons. This works great when zooming... but when rotating the camera tilts in the x axes ??? Any tip? Thanks ...

#

func _input(event) -> void:
if event is InputEventMouseMotion:
rotation.y -= event.relative.x * horizontalSensitivity
rotation.y = wrapf(rotation.y,0.0,TAU)

    rotation.x -= event.relative.y * verticalSensitivity
    rotation.x = clamp(rotation.x, deg2rad(minPitchDeg), deg2rad(maxPitchDeg))
    
elif Input.is_action_pressed("left"):
    rotate_y(0.1)
    rotation.y = wrapf(rotation.y,0.0,TAU)
    
elif Input.is_action_pressed("right"):
    rotate_y(-0.1)
    rotation.y = wrapf(rotation.y,0.0,TAU)
    
elif Input.is_action_pressed("up"):
    rotate_x(0.1)
    rotation.x = clamp(rotation.x, deg2rad(minPitchDeg), deg2rad(maxPitchDeg))
    
elif Input.is_action_pressed("down"):
    rotate_x(-0.1)
    rotation.x = clamp(rotation.x, deg2rad(minPitchDeg), deg2rad(maxPitchDeg))