Skip to content

cf_slide_v3

Category: math
GitHub: cute_math3d.h


Removes from a its component along a surface normal, leaving motion along the surface.

CF_V3 cf_slide_v3(CF_V3 a, CF_V3 n) { return cf_sub_v3(a, cf_mul_v3_f(n, cf_dot_v3(a, n))); }
Parameters Description
a The vector to slide, typically a velocity or movement delta.
n The surface normal. Should be unit length.

Remarks

The move-and-slide primitive: hit a wall, slide the remaining motion along it. Equivalent to a - n * dot(a, n).

CF_V3
cf_reflect_v3
cf_project_v3
cf_dot