idanarye / bevy-tnua

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

Move some configurations (mainly jump-related) from the configuration component to the controls #25

Closed idanarye closed 11 months ago

idanarye commented 1 year ago

Part of the direction I want to go with in #24 is to make the jump use this new movement actions mechanism. Currently the jump parameters are part of TnuaPlatformerConfig, but if the jump action itself is not privileged it doesn't seem right to privilege its configuration, so maybe they should be moved to the action command itself? Currently, jumping is done by:

controls.jump = Some(1.0);

Where the value passed to Some is multiplied by full_jump_height (so Some(1.0) is a full jump). I can do the same with the jump action and have it look at the configuration, but why not instead just remove full_jump_height and pass the actual height to the action (without needing to multiply by anything)? That way, the configuration won't have to "know" about jumping (just like it doesn't know about the other specific actions)

If I do this, maybe I should also remove full_speed from the configuration and just pass the actual speed to controls.desired_velocity?

I'm also thinking about moving some other parameters away from the configuration:

My gut tells me to move only full_jump_height and full_speed out of the configuration, but that was something I lowkey wanted to do even before I started designing the movement actions mechanism, so I'm not sure...

idanarye commented 11 months ago

Done as part of the basis-action refactor.