ioxu / key

Key, a game made with the Godot Engine 4.
MIT License
6 stars 1 forks source link

harmonic spring uses a hard-coded timestep delta #55

Open ioxu opened 1 year ago

ioxu commented 1 year ago

Manifests especially in slowmotion timestep mode. Can easily see springs in player's waist calc at the incorrect rate.

multiplied in in _calc_damped_spring_motion_params add to struct _damped_spring_motion_params, and passed through calls to calculate*( ?

ioxu commented 1 year ago

Not quite sure what to do here because timestep is taken into account ONLY when calculating the coefficients. Maybe measure the ideal delta/timestep and initialise at the start -

ioxu commented 1 year ago

What about in calculate* functions track last delta, ad if new delta is different, re-call initialise with new delta give or take epsilon?

ioxu commented 1 year ago

... let's try that ^

ioxu commented 1 year ago

Seems to work. With a delta diff of about 0.018, it doesn't _reinit too often, but definitely adapts to slowmotion mode.

ioxu commented 1 year ago

not working, threshold working in reverse? Want to detect large relative change in delta. Change from fast delta to slow delta, is small.

ioxu commented 1 year ago

simple https://www.youtube.com/watch?v=YBgCUQVDRkw&ab_channel=MrElipteach