diff options
| author | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-05-12 17:45:18 -0500 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-05-12 17:45:18 -0500 |
| commit | 7f12de60542edc8f1c6683e6b4cdce8570e51456 (patch) | |
| tree | 0b5d533bae189ea286257b5ab78b635fafb19aa0 /PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp | |
| parent | PhysX 3.4, APEX 1.4 patch release @22017166 (diff) | |
| download | physx-3.4-7f12de60542edc8f1c6683e6b4cdce8570e51456.tar.xz physx-3.4-7f12de60542edc8f1c6683e6b4cdce8570e51456.zip | |
PhysX 3.4, APEX 1.4 patch release @22121272
Diffstat (limited to 'PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp')
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp b/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp index 1668a494..f051b6de 100644 --- a/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp +++ b/PhysX_3.4/Source/LowLevel/software/src/PxsCCD.cpp @@ -1015,39 +1015,62 @@ public: pair.mIsModifiable && mCCDContext->getCCDContactModifyCallback()) { - //create a modifiable contact and then - PxModifiableContact point; - point.contact = pair.mMinToiPoint; - point.normal = pair.mMinToiNormal; + + PxU8 dataBuffer[sizeof(PxModifiableContact) + sizeof(PxContactPatch)]; + + PxContactPatch* patch = reinterpret_cast<PxContactPatch*>(dataBuffer); + PxModifiableContact* point = reinterpret_cast<PxModifiableContact*>(patch + 1); + + patch->mMassModification.mInvInertiaScale0 = 1.f; + patch->mMassModification.mInvInertiaScale1 = 1.f; + patch->mMassModification.mInvMassScale0 = 1.f; + patch->mMassModification.mInvMassScale1 = 1.f; + + patch->normal = pair.mMinToiNormal; + + patch->dynamicFriction = pair.mDynamicFriction; + patch->staticFriction = pair.mStaticFriction; + patch->materialIndex0 = pair.mMaterialIndex0; + patch->materialIndex1 = pair.mMaterialIndex1; + + patch->startContactIndex = 0; + patch->nbContacts = 1; + + patch->materialFlags = 0; + patch->internalFlags = 0; //44 //Can be a U16 + + + point->contact = pair.mMinToiPoint; + point->normal = pair.mMinToiNormal; //KS - todo - reintroduce face indices!!!! //point.internalFaceIndex0 = PXC_CONTACT_NO_FACE_INDEX; //point.internalFaceIndex1 = pair.mFaceIndex; - point.materialIndex0 = pair.mMaterialIndex0; - point.materialIndex1 = pair.mMaterialIndex1; - point.dynamicFriction = pair.mDynamicFriction; - point.staticFriction = pair.mStaticFriction; - point.restitution = pair.mRestitution; - point.separation = 0.f; - point.maxImpulse = PX_MAX_REAL; - point.materialFlags= 0; - point.targetVelocity = PxVec3(0.f); - - mCCDContext->runCCDModifiableContact(&point, 1, pair.mCCDShape0->mShapeCore, pair.mCCDShape1->mShapeCore, + point->materialIndex0 = pair.mMaterialIndex0; + point->materialIndex1 = pair.mMaterialIndex1; + point->dynamicFriction = pair.mDynamicFriction; + point->staticFriction = pair.mStaticFriction; + point->restitution = pair.mRestitution; + point->separation = 0.f; + point->maxImpulse = PX_MAX_REAL; + point->materialFlags = 0; + point->targetVelocity = PxVec3(0.f); + + mCCDContext->runCCDModifiableContact(point, 1, pair.mCCDShape0->mShapeCore, pair.mCCDShape1->mShapeCore, pair.mCCDShape0->mRigidCore, pair.mCCDShape1->mRigidCore, pair.mBa0, pair.mBa1); //If the maxImpulse is 0, we return to the beginning of the loop, knowing that the application did not want an interaction //between the pair. - if(point.maxImpulse == 0.f) + if(point->maxImpulse == 0.f) { pair.mMinToi = PX_MAX_REAL; continue; } - pair.mDynamicFriction = point.dynamicFriction; - pair.mStaticFriction = point.staticFriction; - pair.mRestitution = point.restitution; - pair.mMinToiPoint = point.contact; - pair.mMinToiNormal = point.normal; + pair.mDynamicFriction = point->dynamicFriction; + pair.mStaticFriction = point->staticFriction; + pair.mRestitution = point->restitution; + pair.mMinToiPoint = point->contact; + pair.mMinToiNormal = point->normal; } |