|
@@ -140,12 +140,16 @@ void CharacterVirtual::ContactCollector::AddHit(const CollideShapeResult &inResu
|
|
BodyLockRead lock(mSystem->GetBodyLockInterface(), inResult.mBodyID2);
|
|
BodyLockRead lock(mSystem->GetBodyLockInterface(), inResult.mBodyID2);
|
|
if (lock.SucceededAndIsInBroadPhase())
|
|
if (lock.SucceededAndIsInBroadPhase())
|
|
{
|
|
{
|
|
|
|
+ // We don't collide with sensors, note that you should set up your collision layers so that sensors don't collide with the character.
|
|
|
|
+ // Rejecting the contact here means a lot of extra work for the collision detection system.
|
|
const Body &body = lock.GetBody();
|
|
const Body &body = lock.GetBody();
|
|
-
|
|
|
|
- mContacts.emplace_back();
|
|
|
|
- Contact &contact = mContacts.back();
|
|
|
|
- sFillContactProperties(mCharacter, contact, body, mUp, mBaseOffset, *this, inResult);
|
|
|
|
- contact.mFraction = 0.0f;
|
|
|
|
|
|
+ if (!body.IsSensor())
|
|
|
|
+ {
|
|
|
|
+ mContacts.emplace_back();
|
|
|
|
+ Contact &contact = mContacts.back();
|
|
|
|
+ sFillContactProperties(mCharacter, contact, body, mUp, mBaseOffset, *this, inResult);
|
|
|
|
+ contact.mFraction = 0.0f;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -170,8 +174,14 @@ void CharacterVirtual::ContactCastCollector::AddHit(const ShapeCastResult &inRes
|
|
if (!lock.SucceededAndIsInBroadPhase())
|
|
if (!lock.SucceededAndIsInBroadPhase())
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ // We don't collide with sensors, note that you should set up your collision layers so that sensors don't collide with the character.
|
|
|
|
+ // Rejecting the contact here means a lot of extra work for the collision detection system.
|
|
|
|
+ const Body &body = lock.GetBody();
|
|
|
|
+ if (body.IsSensor())
|
|
|
|
+ return;
|
|
|
|
+
|
|
// Convert the hit result into a contact
|
|
// Convert the hit result into a contact
|
|
- sFillContactProperties(mCharacter, contact, lock.GetBody(), mUp, mBaseOffset, *this, inResult);
|
|
|
|
|
|
+ sFillContactProperties(mCharacter, contact, body, mUp, mBaseOffset, *this, inResult);
|
|
}
|
|
}
|
|
|
|
|
|
contact.mFraction = inResult.mFraction;
|
|
contact.mFraction = inResult.mFraction;
|