idanarye / bevy-tnua

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

Something causes the character to float up #3

Closed janhohenheim closed 1 year ago

janhohenheim commented 1 year ago

image

Right after reporting #2, I tabbed back into the 3D platforming example and found the character wayyyy up in the sky. It took them a while to fall down to the ground. I don't know if this is a consequence of #2, caused by the general lag of me having other stuff open on my computer at the same time, the tabbing out or the waiting.

Repro steps:

idanarye commented 1 year ago

This is the problem:

let dampening_force = relative_velocity * config.spring_dampening;

The dampening force is linear with the velocity, but it's an acceleration rather than a velocity so if a frame is long its effects are drastic. I'll have to multiply it by the frame duration - which means that spring_dampening will have to be re-calibrated, making this a breaking change.

janhohenheim commented 1 year ago

Wow, good job on finding the problem this quickly! :)