Explorar o código

rigid body on rigid body reactions

Azaezel %!s(int64=9) %!d(string=hai) anos
pai
achega
6a930f3da1

+ 9 - 2
Engine/source/T3D/rigidShape.cpp

@@ -1230,8 +1230,15 @@ bool RigidShape::resolveCollision(Rigid&  ns,CollisionList& cList)
 
             // Apply impulses to the rigid body to keep it from
             // penetrating the surface.
-            ns.resolveCollision(cList[i].point,
-               cList[i].normal);
+            if (c.object->getTypeMask() & VehicleObjectType)
+            {
+                  RigidShape* otherRigid = dynamic_cast<RigidShape*>(c.object);
+                  if (otherRigid)
+                     ns.resolveCollision(cList[i].point, cList[i].normal, &otherRigid->mRigid);
+                  else
+                     ns.resolveCollision(cList[i].point, cList[i].normal);
+            }
+            else ns.resolveCollision(cList[i].point, cList[i].normal);
             collided = true;
 
             // Keep track of objects we collide with

+ 1 - 1
Engine/source/T3D/rigidShape.h

@@ -188,7 +188,6 @@ class RigidShape: public ShapeBase
 
    CollisionList mCollisionList;
    CollisionList mContacts;
-   Rigid mRigid;
    ShapeBaseConvex mConvex;
    S32 restCount;
 
@@ -233,6 +232,7 @@ class RigidShape: public ShapeBase
 public:
    // Test code...
    static ClippedPolyList* sPolyList;
+   Rigid mRigid;
 
    //
    RigidShape();

+ 0 - 1
Engine/source/T3D/vehicles/vehicle.h

@@ -189,7 +189,6 @@ class Vehicle : public RigidShape
 
    CollisionList mCollisionList;
    CollisionList mContacts;
-   Rigid mRigid;
    ShapeBaseConvex mConvex;
    S32 restCount;