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

Method setKinematic

physx/source/lowlevel/software/src/PxsIslandSim.cpp:2086–2212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2084}
2085
2086void IslandSim::setKinematic(IG::NodeIndex nodeIndex)
2087{
2088
2089 Node& node = mNodes[nodeIndex.index()];
2090
2091 if(!node.isKinematic())
2092 {
2093
2094 //Transition from dynamic to kinematic:
2095 //(1) Remove this node from the island
2096 //(2) Remove this node from the active node list
2097 //(3) If active or referenced, add it to the active kinematic list
2098 //(4) Tag the node as kinematic
2099 //External code will re-filter interactions and lost touches will be reported
2100
2101 IslandId islandId = mIslandIds[nodeIndex.index()];
2102 PX_ASSERT(islandId != IG_INVALID_ISLAND);
2103
2104 Island& island = mIslands[islandId];
2105
2106 mIslandIds[nodeIndex.index()] = IG_INVALID_ISLAND;
2107
2108 removeNodeFromIsland(island, nodeIndex);
2109
2110 bool isActive = node.isActive();
2111
2112 if (isActive)
2113 {
2114 //Remove from active list...
2115 markInactive(nodeIndex);
2116 }
2117 else if (node.isActivating())
2118 {
2119 //Remove from activating list...
2120 node.clearActivating();
2121 PX_ASSERT(mActivatingNodes[mActiveNodeIndex[nodeIndex.index()]].index() == nodeIndex.index());
2122
2123 NodeIndex replaceIndex = mActivatingNodes[mActivatingNodes.size() - 1];
2124 mActiveNodeIndex[replaceIndex.index()] = mActiveNodeIndex[nodeIndex.index()];
2125 mActivatingNodes[mActiveNodeIndex[nodeIndex.index()]] = replaceIndex;
2126 mActivatingNodes.forceSize_Unsafe(mActivatingNodes.size() - 1);
2127 mActiveNodeIndex[nodeIndex.index()] = IG_INVALID_NODE;
2128 }
2129
2130 node.setKinematicFlag();
2131
2132 node.clearActive();
2133
2134 if (/*isActive || */node.mActiveRefCount != 0)
2135 {
2136 //Add to active kinematic list...
2137 PX_ASSERT(mActiveNodeIndex[nodeIndex.index()] == IG_INVALID_NODE);
2138
2139 mActiveNodeIndex[nodeIndex.index()] = mActivatingNodes.size();
2140 mActivatingNodes.pushBack(nodeIndex);
2141 node.setActivating();
2142 }
2143

Callers 1

postSwitchToKinematicMethod · 0.45

Calls 15

indexMethod · 0.80
clearInsertedMethod · 0.80
isPendingDestroyedMethod · 0.80
isInDirtyListMethod · 0.80
markInDirtyListMethod · 0.80
setReportOnlyDestroyMethod · 0.80
freeHandleMethod · 0.80
containsFunction · 0.70
isKinematicMethod · 0.45
isActiveMethod · 0.45
sizeMethod · 0.45
forceSize_UnsafeMethod · 0.45

Tested by

no test coverage detected