Set my Camera to follow an exported variable, which is set to the player node and the player makes little "jumps" when slowing down (velocity of player is lerped), see the video. Here's also the camera code:
class_name CameraIsometric extends Node3D
signal camera_isometric_rotated(rotation: float)
const DEFAULT_ROTATION: float = -45
## The IsometricCamera will follow the target, optional
@export var follow_target : Node3D = null
@export_range(0, 1) var camera_sensitivity: float = 0.25
@onready var input_events: InputEventsComponent = $InputEventsComponent
var mouse_movement: Vector2 = Vector2.ZERO
func _input(event: InputEvent) -> void:
if input_events.is_camera_reset_pressed():
rotation.y = DEFAULT_ROTATION
if event is InputEventMouseMotion:
mouse_movement = event.relative.normalized()
func _ready() -> void:
# Signal should be emitted after all other nodes in the tree are ready,
# so they can listen
await owner.ready
# ToDo **PLACEHOLDER**
#SignalBus.emit_camera_rotation_changed(rotation_degrees.y)
func _process(delta: float) -> void:
if input_events.is_camera_rotation_pressed():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
if abs(mouse_movement.x) > 0.1:
var yaw: float = mouse_movement.x * camera_sensitivity
rotate_y(deg_to_rad(-yaw))
else:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func _physics_process(delta: float) -> void:
if follow_target:
position = follow_target.global_position
Edit: attached video more than once. fixed