Table of Contents

Method ClipVelocity

Namespace
Box3D
Assembly
Box3D.NET.dll

ClipVelocity(Vector3, ReadOnlySpan<CollisionPlane>)

Projects a velocity onto the planes that resisted the movement.

public static Vector3 ClipVelocity(Vector3 velocity, ReadOnlySpan<CollisionPlane> planes)

Parameters

velocity Vector3

The velocity to clip.

planes ReadOnlySpan<CollisionPlane>

The planes, as returned by Box3D.CharacterMover.SolvePlanes(System.Numerics.Vector3,System.Span{Box3D.CollisionPlane}). Planes with no push, or with Box3D.CollisionPlane.ClipsVelocity false, are skipped.

Returns

Vector3

The clipped velocity.

Remarks

Without this a character walking into a wall keeps building up velocity into it, and shoots sideways the moment the wall ends.