MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / convert

Method convert

physx/source/simulationcontroller/src/ScNPhaseCore.cpp:1075–1140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1073}
1074
1075Sc::ElementSimInteraction* Sc::NPhaseCore::convert(ElementSimInteraction* pair, InteractionType::Enum newType, PxFilterInfo& filterInfo, bool removeFromDirtyList,
1076 PxsContactManagerOutputIterator& outputs, bool useAdaptiveForce)
1077{
1078 PX_ASSERT(newType != pair->getType());
1079
1080 ElementSim& elementA = pair->getElement0();
1081 ElementSim& elementB = pair->getElement1();
1082
1083 // Wake up the actors of the pair
1084 if((pair->getActorSim0().getActorType() == PxActorType::eRIGID_DYNAMIC) && !(static_cast<BodySim&>(pair->getActorSim0()).isActive()))
1085 static_cast<BodySim&>(pair->getActorSim0()).internalWakeUp();
1086 if((pair->getActorSim1().getActorType() == PxActorType::eRIGID_DYNAMIC) && !(static_cast<BodySim&>(pair->getActorSim1()).isActive()))
1087 static_cast<BodySim&>(pair->getActorSim1()).internalWakeUp();
1088
1089 // Since the FilterPair struct might have been re-used in the newly created interaction, we need to clear
1090 // the filter pair marker of the old interaction to avoid that the FilterPair gets deleted by the releaseElementPair()
1091 // call that follows.
1092 pair->clearInteractionFlag(InteractionFlag::eIS_FILTER_PAIR);
1093
1094 // PT: we need to unregister the old interaction *before* creating the new one, because Sc::NPhaseCore::registerInteraction will use
1095 // ElementSim pointers which are the same for both. Since "releaseElementPair" will call the unregister function from
1096 // the element's dtor, we don't need to do it explicitly here. Just release the object.
1097 releaseElementPair(pair, PairReleaseFlag::eWAKE_ON_LOST_TOUCH | PairReleaseFlag::eBP_VOLUME_REMOVED, 0, removeFromDirtyList, outputs, useAdaptiveForce);
1098
1099 ElementSimInteraction* result = NULL;
1100 switch(newType)
1101 {
1102 case InteractionType::eINVALID:
1103 // This means the pair should get killed
1104 break;
1105 case InteractionType::eMARKER:
1106 {
1107 result = createElementInteractionMarker(elementA, elementB, NULL);
1108 break;
1109 }
1110 case InteractionType::eOVERLAP:
1111 {
1112 result = createShapeInteraction(static_cast<ShapeSim&>(elementA), static_cast<ShapeSim&>(elementB), filterInfo.pairFlags, NULL, NULL);
1113 break;
1114 }
1115 case InteractionType::eTRIGGER:
1116 {
1117 result = createTriggerInteraction(static_cast<ShapeSim&>(elementA), static_cast<ShapeSim&>(elementB), filterInfo.pairFlags);
1118 break;
1119 }
1120 case InteractionType::eCONSTRAINTSHADER:
1121 case InteractionType::eARTICULATION:
1122 case InteractionType::eTRACKED_IN_SCENE_COUNT:
1123 PX_ASSERT(0);
1124 break;
1125 };
1126
1127 if(filterInfo.filterPairIndex != INVALID_FILTER_PAIR_INDEX)
1128 {
1129 PX_ASSERT(result);
1130 // If a filter callback pair is going to get killed, then the FilterPair struct should already have
1131 // been deleted.
1132

Callers 2

snippetMainFunction · 0.45
findActorPairMethod · 0.45

Calls 5

setPairMethod · 0.80
setFilterPairIndexMethod · 0.80
getTypeMethod · 0.45
isActiveMethod · 0.45
internalWakeUpMethod · 0.45

Tested by

no test coverage detected