diff --git a/godot/src/player_input.gd b/godot/src/player_input.gd index 4147e91..5cecc8c 100644 --- a/godot/src/player_input.gd +++ b/godot/src/player_input.gd @@ -126,18 +126,18 @@ func next_velocity(speed: float, dir: Vector2 = movement_dir) -> Vector3: return Vector3(dir.x, 0, dir.y) * speed func get_mouse_look() -> Vector3: - var cam: Camera3D = _active_camera # Use your convenient getter + var cam: Camera3D = _active_camera if not cam: - return Vector3.ZERO # Should not happen, but good for safety + return Vector3.ZERO - var mouse_pos = _mouse_position # Your 2D mouse position getter + var mouse_pos = _mouse_position var ray_origin = cam.project_ray_origin(mouse_pos) var ray_direction = cam.project_ray_normal(mouse_pos) - var plane_normal = Vector3.UP # Normal vector of a horizontal plane - var plane_d = 1.5 # The 'D' in the plane equation Ax+By+Cz=D + var plane_normal = Vector3.UP + var plane_d = 1.5 # make this read from the weapon transform, or at least export it var denominator = plane_normal.dot(ray_direction) if abs(denominator) < 0.0001: return Vector3(ray_origin.x, 1.5, ray_origin.z)