Jump to content
  • Advertisement
Sign in to follow this  
Mohsen Zarsanj

OnCollisionExit and OnCollisionStay using PhysX 3.2

This topic is 2063 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:


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();
}


and an onContact function:


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


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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!