i just want to make it not come to an abrupt stop and glide smoothly for a while and that’s it
extends CharacterBody2D
@export var speed = 400
@export var rotation_speed = 2.5
@export var rotation_growth = 2.0
var rotation_direction = 0
var totalrotationspeed = 0
func get_input():
rotation_direction = Input.get_axis("left", "right")
velocity = transform.x * Input.get_axis("thrustdown", "thrustup") * speed
func _physics_process(delta: float) -> void:
if Input.get_axis("left", "right") == 0:
totalrotationspeed -= rotation_growth * delta
totalrotationspeed = clampf(totalrotationspeed, 0.0, rotation_speed)
else:
totalrotationspeed += rotation_growth * delta
totalrotationspeed = clampf(totalrotationspeed, 0.0, rotation_speed)
if Input.get_axis("thrustdown", "thrustup") == 0:
velocity = transform.x * lerpf(speed, 0.0, 0.1)
get_input()
rotation += rotation_direction * totalrotationspeed * delta
move_and_slide()
and the rotation at the beginning works fine but stops instantly when released