Sign in to follow this  

OnCollisionExit and OnCollisionStay using PhysX 3.2

This topic is 1849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone.
I'm working with physX 3.2 and going to write an OnCollisionEnter, OnCollisionStay and an OnCollisionExit for a physics engine.
I have implemented a sample filter shader like this:

[CODE]
PxFilterFlags PhysXSample::SampleFilterShader(
PxFilterObjectAttributes attributes0, PxFilterData filterData0,
PxFilterObjectAttributes attributes1, PxFilterData filterData1,
PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize)
{
if(PxFilterObjectIsTrigger(attributes0) || PxFilterObjectIsTrigger(attributes1))
{
pairFlags = PxPairFlag::eTRIGGER_DEFAULT;
return PxFilterFlag::eDEFAULT;
}
pairFlags |= PxPairFlag::eCONTACT_DEFAULT;
pairFlags |= PxPairFlag::eNOTIFY_CONTACT_POINTS;
if (filterData0.word2 & FilterDynamic::eCCD || filterData1.word2 & FilterDynamic::eCCD)
{
pairFlags |= PxPairFlag::eRESOLVE_CONTACTS;
pairFlags |= PxPairFlag::eSWEPT_INTEGRATION_LINEAR;
}
if((filterData0.word0 & filterData1.word1) && (filterData1.word0 & filterData0.word1))
{
pairFlags |= PxPairFlag::eNOTIFY_TOUCH_FOUND;
}
else
{
return PxFilterFlag::eSUPPRESS;
}
return PxFilterFlags();
}
[/CODE]

and an onContact function:

[CODE]
void CollisionCallback::onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs)
{
for(PxU32 i=0; i < nbPairs; i++)
{
const PxContactPair& cp = pairs[i];
if(cp.events & PxPairFlag::eNOTIFY_TOUCH_FOUND)
{
}
}
}
[/CODE]

eNOTIFY_TOUCH_FOUND works fine but the problem is that I don't know how to tell the shader to notify the eNOTIFY_TOUCH_PERSIST and eNOTIFY_TOUCH_LOST, and if they are notified, how to catch them in the onContact function.

is there anybody who can help me on this? I would really appreciate.

Share this post


Link to post
Share on other sites

This topic is 1849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this