Closed ioxu closed 1 year ago
Can't work it out.
movement_speed
is set in enemy finite state machine actions, multiplied by delta
eg:
https://github.com/ioxu/key/blob/d1c8bbb59f8b4a149720f69a470137f88b82904b/data/enemies/Enemy.gd#L419
delta
is passed to fsm states in statemachine.gd
https://github.com/ioxu/key/blob/d1c8bbb59f8b4a149720f69a470137f88b82904b/data/statemachine/statemachine.gd#L14-L19
... there must be an un-delta'd term in enemy._physics_process()
nb to change physics ticks per second:
Engine.set_physics_ticks_per_second(value)
... I completely forgot that move_and_slide()
applies delta
itself:
https://docs.godotengine.org/en/4.0/tutorials/physics/physics_introduction.html#move-and-slide
* delta
from velocities, but not accelerations_idle()
(rot_y
and speedir_normoise
)do_fire
noise time in _attack()
I think that's got it. 🚀
Recently lowered project
physics/common/physics_ticks_per_second
from 120 to 60 fps, and now enemies move too fast. Frame delta is not integrated correctly somewhere in enemy_physics_process
. Enemy FSM is involved - fsm base class passes delta to each state from its own_physics_process
.