project_velocity

Function project_velocity 

Source
pub fn project_velocity(v: Vector, normals: &[Dir]) -> Vector
Expand description

Projects input velocity v onto the planes defined by the given normals. This ensures that velocity does not point into any of the planes, but along them.

This is often used after MoveAndSlide::cast_move to ensure a character moved that way does not try to continue moving into colliding geometry.

This function uses a GJK-like algorithm to solve the dual problem to velocity projection, from which obtaining the solution of the primal problem is simple. See https://benspiers.co.uk/Games/Velocity-Projection for the full mathematical details.