Godot Version
4.3
Question
Hi, I’m learning Godot and I want to make my character rotate smoothly towards where they face to, some help would be really appreciated!
extends CharacterBody3D
@onready var anim_tree : AnimationTree = $AnimationTree
@onready var armature = $Leopold/Armature
@onready var anim = $Leopold/AnimationPlayer
var character
const SPEED = 5.0
const LERP_VAL = .15
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity += get_gravity() * delta
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir := Input.get_vector("right", "left", "back", "forward")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
move_and_slide()
I want the game to have this pseudo isometric view, making it clear just in case!