Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


OnCollisionExit and OnCollisionStay using PhysX 3.2


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 zar2012   Members   -  Reputation: 137

Like
0Likes
Like

Posted 21 November 2012 - 05:34 AM

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[i];
  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.

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS