Godot Version
4.6
Question
Can’t attach a video due to my account age, but the video is posted on Reddit.
An issue seemed to arise out of nowhere where my player camera, (which was working completly fine regardless of the resolution) began jittering and moving incredibly fast all over the place when in fullscreen resolution. This doesn’t occur in windowed resolutions. My resolution is 2560 x 1440. I left some of my player code which includes my camera logic, but I don’t think it has anything to do with the bug. Maybe someone knows something?
The only change I made recently was importing a model and some textures and creating a scene, but once again I don’t think that has anything to do with it. The bug occurs regardless of if the main scene has that new model in it or not.
Update: It just stopped doing it? Maybe an engine bug or something. Still a bit afraid it will come back, though.
extends CharacterBody3D
class_name Player
@export_category("Camera")
@export_range(10, 100, 10) var smooth_speed := 30.0
var mouse_sensitivity : float = 0.003
var target_camera_rotation := Vector2.ZERO
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton and Input.mouse_mode != Input.MOUSE_MODE_CAPTURED and movement_enabled:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
elif event.is_action_pressed("ui_cancel"):
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
#If mouse is captured, set the camera rotation to the relative mouse position * the mouse sensitivity. Rotation is reversed in 3D from 2D.
func _unhandled_input(event: InputEvent) -> void:
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED and event is InputEventMouseMotion:
#Gets mouse location on screen * sensitivity
target_camera_rotation.x -= event.relative.y * mouse_sensitivity
target_camera_rotation.y -= event.relative.x * mouse_sensitivity
const MAX_ANGLE : float = PI/2.1
target_camera_rotation.x = clampf(target_camera_rotation.x, -MAX_ANGLE, MAX_ANGLE)
#Light Logic
if event.is_action_pressed("light") and movement_enabled:
if is_candle_enabled == true:
candle.enable_candle(false)
is_candle_enabled = false
extinguish.play()
burning.stop()
world_environment.environment.fog_enabled = true
else:
var ignite_chance := randf_range(1, 5)
match_strike.play()
if ignite_chance >= 4:
ignite.play()
burning.play()
candle.enable_candle(true)
is_candle_enabled = true
world_environment.environment.fog_enabled = false
#Lerps the camera rotation by the smooth speed. Lerp_angle handles wrap.
func _process(delta: float) -> void:
_camera_3d.rotation.x = lerp(_camera_3d.rotation.x, target_camera_rotation.x, smooth_speed * delta)
_camera_3d.rotation.y = lerp_angle(_camera_3d.rotation.y, target_camera_rotation.y, smooth_speed * delta)