![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Moot Point |
Hi. I’m porting an early project into Godot 4, and my knockback/attack-dash stopped working, the move_toward function is not moving the knockback vector to zero like in Godot 3.5. It’s a 3D game.
Code example from 3.5 where it works inside the attack function:
knockback_vector = knockback_vector.move_toward(Vector3.ZERO, 50 * delta)
knockback_vector = move_and_slide(knockback_vector)
The knockback_vector is the last input direction if you attack, and one between you and your enemy when you get attacked so I can reutilize the code.
This was the latest attempt at Godot 4:
velocity = knockback_vector.move_toward(Vector3.ZERO, 50 * delta)
velocity += knockback_vector
The move_toward is not reducing knockback to 0 like this, is there a bug or am I blatantly wrong in this approach?