feat: implemented avoidance and exposed speed settings to editor

This commit is contained in:
Sara 2025-07-22 20:02:33 +02:00
parent fb9417a1d8
commit 2134fcae92
8 changed files with 61 additions and 14 deletions

View file

@ -11,10 +11,10 @@ void EnemyBody::ready() {
void EnemyBody::physics_process(double delta) {
GETSET(velocity, {
velocity = Vector3{ this->movement_direction.x, velocity.y, this->movement_direction.y };
velocity = Vector3{ this->movement_direction.x * this->movement_speed, velocity.y, this->movement_direction.y * this->movement_speed };
});
if (!get_velocity().is_zero_approx()) {
look_at(get_global_position() + get_velocity());
if (!this->movement_direction.is_zero_approx()) {
look_at(get_global_position() + Vector3{ this->movement_direction.x, 0.f, this->movement_direction.y });
}
move_and_slide();
}