camera: made camera more responsive and removed camera strafing

This commit is contained in:
Simon Ward 2026-01-24 12:13:41 +13:00 committed by Jeremy Baxter
parent d4b571428b
commit 76694fda2f

View file

@ -21,8 +21,8 @@ func rotate_camera_x(x, delta):
func _input(event): func _input(event):
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
mouse_x_velocity = event.velocity.x mouse_x_velocity = event.relative.x
mouse_y_velocity = event.velocity.y mouse_y_velocity = event.relative.y
func _process(delta): func _process(delta):
# rotate outer gimbal around y axis # rotate outer gimbal around y axis
@ -40,10 +40,10 @@ func _process(delta):
locked_mouse_positon = get_viewport().get_mouse_position() locked_mouse_positon = get_viewport().get_mouse_position()
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
if mouse_x_velocity > 200 or mouse_x_velocity < -200: if mouse_x_velocity > 5 or mouse_x_velocity < -5:
y -= clamp(mouse_x_velocity / 500, -5, 5) y -= clamp(mouse_x_velocity / 12.5, -10, 10)
if mouse_y_velocity > 200 or mouse_y_velocity < -200: if mouse_y_velocity > 5 or mouse_y_velocity < -5:
x -= clamp(mouse_y_velocity / 1000, -5, 5) x -= clamp(mouse_y_velocity / 12.5, -10, 10)
else: else:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
mouse_locked = false mouse_locked = false