@gkl223 said:
It seems the apply_central_impulse()
has one frame delay (or other reasons) so the _process()
is called before physics calculation where velocity is added to the object.
As I know Godot processing works as follows:
_physics_process() #Game specific logic connected with physics
(...) #Internal physics calculations, collisions etc.
_process() #Other logic not connected with physics
Maybe you should try call your method in _physics_process()
instead?
@gkl223 said:
Actually I don't know that Vector2().normalized() gives Vector2(). That's weird in the world of maths xd
You mean Vector2(0.0, 0.0).normalized() return Vector2(0.0, 0.0)? Normalized vector is done dividing vector by its lenght. In case of Vector2.ZERO it would cause "divide by 0 exception", so it seems resonable it return just the same value, optionally it could assert execution, but would be that better?