idanarye / bevy-tnua

A floating character controller for Bevy
https://crates.io/crates/bevy-tnua
Apache License 2.0
235 stars 16 forks source link

Support fixating the horizontal distance of jumps #20

Open idanarye opened 1 year ago

idanarye commented 1 year ago

Tnua lets you set a jump height and calculates the initial vertical velocity from there. This allows games to fixate the height a character can jump, which is important for level design, and then work on the other parameters to make the jump feel good.

But the height of the jump is not the only important parameter for level design. Level design also cares about the horizontal distance - how long a gap can the character cover when jumping? It would be beneficial for Tnua to fixate that number as well, and calculate various parameters (like gravity?) from it.

The horizontal distance is the multiplication of the horizontal velocity by the duration of the jump. The horizontal velocity is already fixated with TnuaPlatformerConfig::full_speed, but can be varied by game actions (like dashing), so it will probably be better to control for the jump duration instead.