]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Vector: add a reflect function with bounce factor
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 19 Jun 2016 07:00:02 +0000 (17:00 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 19 Jun 2016 07:00:02 +0000 (17:00 +1000)
qcsrc/lib/vector.qh

index def1dae2d489f512a0c677087943814c00f8b8a7..adb6d6a95b272fdfc59f6c650e318411ad3738c3 100644 (file)
@@ -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)
        {