CapsuleCast direction and distance from velocity

Hi, I’m suffering from IQ failure. I have a capsule at world position Pxyz and it has a velocity Vxyz.

How do I give CapsuleCast the direction and distance from the position and velocity?

I have a feeling that distance is going to be Pxyz + (Vxyz * Time.deltaTime), but I’m not sure how to give the direction, when the velocity could be any direction in any plane, and probably in more than one plane simultaneously.

This is running in a FixedUpdate() to control the movement of characters.

Many thanks for any help :slight_smile:

Your direction can be calculated using the normalized direction of velocity:

velocity.normalized(); // In your terms Vxyz.normalized

and distance can be:

distance = 10.0f

this will perform a CapsuleCast for 10 units from the starting point of the capsule cast i.e. your position Pxyz.