From 6a930f3da122e179964d452b00d226aeae1f67ee Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 21 Jan 2016 19:05:48 -0600 Subject: [PATCH] rigid body on rigid body reactions --- Engine/source/T3D/rigidShape.cpp | 11 +++++++++-- Engine/source/T3D/rigidShape.h | 2 +- Engine/source/T3D/vehicles/vehicle.h | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index 7d85fa6a5..c057228ca 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/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(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 diff --git a/Engine/source/T3D/rigidShape.h b/Engine/source/T3D/rigidShape.h index ecd7953b1..6f6b9fcea 100644 --- a/Engine/source/T3D/rigidShape.h +++ b/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(); diff --git a/Engine/source/T3D/vehicles/vehicle.h b/Engine/source/T3D/vehicles/vehicle.h index 86da8693a..244c39b2c 100644 --- a/Engine/source/T3D/vehicles/vehicle.h +++ b/Engine/source/T3D/vehicles/vehicle.h @@ -189,7 +189,6 @@ class Vehicle : public RigidShape CollisionList mCollisionList; CollisionList mContacts; - Rigid mRigid; ShapeBaseConvex mConvex; S32 restCount;