From: TimePath Date: Sun, 19 Jun 2016 07:00:02 +0000 (+1000) Subject: Vector: add a reflect function with bounce factor X-Git-Tag: xonotic-v0.8.2~780 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9bb4a3a6b4d0003fa58d090b368f7533cbee99c2;p=xonotic%2Fxonotic-data.pk3dir.git Vector: add a reflect function with bounce factor --- diff --git a/qcsrc/lib/vector.qh b/qcsrc/lib/vector.qh index def1dae2d..adb6d6a95 100644 --- a/qcsrc/lib/vector.qh +++ b/qcsrc/lib/vector.qh @@ -116,6 +116,14 @@ vector reflect(vector dir, vector norm) return dir - 2 * (dir * norm) * norm; } +/** + * clip vel along the plane defined by norm (assuming 0 distance away), bounciness determined by bounce 0..1 + */ +vector vec_reflect(vector vel, vector norm, float bounce) +{ + return vel - (1 + bounce) * (vel * norm) * norm; +} + #ifndef MENUQC vector get_corner_position(entity box, int corner) {