MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / onContact

Method onContact

deps/physx/physx/samples/samplesubmarine/SampleSubmarine.cpp:886–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884///////////////////////////////////////////////////////////////////////////////
885
886void SampleSubmarine::onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs)
887{
888 for(PxU32 i=0; i < nbPairs; i++)
889 {
890 const PxContactPair& cp = pairs[i];
891
892 if(cp.events & PxPairFlag::eNOTIFY_TOUCH_FOUND)
893 {
894 if((pairHeader.actors[0] == mSubmarineActor) || (pairHeader.actors[1] == mSubmarineActor))
895 {
896 PxActor* otherActor = (mSubmarineActor == pairHeader.actors[0]) ? pairHeader.actors[1] : pairHeader.actors[0];
897 Seamine* mine = reinterpret_cast<Seamine*>(otherActor->userData);
898 // insert only once
899 if(std::find(mMinesToExplode.begin(), mMinesToExplode.end(), mine) == mMinesToExplode.end())
900 mMinesToExplode.push_back(mine);
901
902 break;
903 }
904 }
905 }
906}
907
908///////////////////////////////////////////////////////////////////////////////
909

Callers 2

runMethod · 0.45

Calls 4

findFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected