How would I apply central impulse to make the rigid body go in a certain direction?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By xdrenal

I’m trying to apply impulse to a rigid body in the direction that my rayCast is facing. How would I be able to do this?

:bust_in_silhouette: Reply From: SteveSmith

https://docs.godotengine.org/en/stable/classes/class_rigidbody.html#class-rigidbody-method-apply-central-impulse

This doesn’t help. I already know about the method. I’m asking how to apply impulse to the direction of a ray casts rotation.

xdrenal | 2023-01-31 22:36

It would be something like body.apply_central_impulse(raycast.cast_to) if the raycast is relative to the body.

SteveSmith | 2023-02-01 07:10