瀏覽代碼

Backend correction for the rigid vs rigid collision resolver:
First line is to ensure similar behavior to current regarding pushback on the object doing the colliding.
Second line applies an impulse to the rigid that was collided with.

Azaezel 10 年之前
父節點
當前提交
691a08bb33
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Engine/source/T3D/rigid.cpp

+ 2 - 2
Engine/source/T3D/rigid.cpp

@@ -156,7 +156,7 @@ bool Rigid::resolveCollision(const Point3F& p, const Point3F &normal, Rigid* rig
       return false;
       return false;
 
 
    // Compute impulse
    // Compute impulse
-   F32 d, n = -nv * (1.0f + restitution * rigid->restitution);
+   F32 d, n = -nv * (2.0f + restitution * rigid->restitution);
    Point3F a1,b1,c1;
    Point3F a1,b1,c1;
    mCross(r1,normal,&a1);
    mCross(r1,normal,&a1);
    invWorldInertia.mulV(a1,&b1);
    invWorldInertia.mulV(a1,&b1);
@@ -173,7 +173,7 @@ bool Rigid::resolveCollision(const Point3F& p, const Point3F &normal, Rigid* rig
 
 
    applyImpulse(r1,impulse);
    applyImpulse(r1,impulse);
    impulse.neg();
    impulse.neg();
-   applyImpulse(r2,impulse);
+   rigid->applyImpulse(r2, impulse);
    return true;
    return true;
 }
 }