fix: jump speed being incorrect

This commit is contained in:
Sara 2025-06-09 01:12:53 +02:00
parent 6fbdfaf863
commit 88e6017903
2 changed files with 2 additions and 2 deletions

View file

@ -194,8 +194,7 @@ void JumpingState::state_entered() {
Vector3 const current{this->get_body()->get_velocity()}; Vector3 const current{this->get_body()->get_velocity()};
Vector2 const impulse{this->get_body()->get_jump_impulse()}; Vector2 const impulse{this->get_body()->get_jump_impulse()};
this->get_body()->set_velocity( ( this->get_body()->set_velocity( (
Vector3{current.x, impulse.y, current.z} Vector3{current.x * impulse.x, impulse.y, current.z * impulse.x}
+ current.normalized() * impulse.x
)); ));
this->get_body()->get_anim()->play("jump"); this->get_body()->get_anim()->play("jump");
} }

View file

@ -33,6 +33,7 @@ floor_max_angle = 0.460767
floor_snap_length = 0.35 floor_snap_length = 0.35
acceleration = 10.0 acceleration = 10.0
target_speed = 25.0 target_speed = 25.0
jump_impulse = Vector2(0.9, 5)
[node name="PlayerStateMachine" type="PlayerStateMachine" parent="."] [node name="PlayerStateMachine" type="PlayerStateMachine" parent="."]