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

Method setDynamic

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

Source from the content-addressed store, hash-verified

2212}
2213
2214void IslandSim::setDynamic(IG::NodeIndex nodeIndex)
2215{
2216 //(1) Remove all edges involving this node from all islands they may be in
2217 //(2) Mark all edges as "new" edges - let island gen re-process them!
2218 //(3) Remove this node from the active kinematic list
2219 //(4) Add this node to the active dynamic list (if it is active)
2220 //(5) Mark node as dynamic
2221
2222
2223 Node& node = mNodes[nodeIndex.index()];
2224
2225 if(node.isKinematic())
2226 {
2227 //EdgeInstanceIndex edgeIndex = node.mFirstEdgeIndex;
2228
2229 EdgeInstanceIndex edgeId = node.mFirstEdgeIndex;
2230 while(edgeId != IG_INVALID_EDGE)
2231 {
2232 EdgeInstance& instance = mEdgeInstances[edgeId];
2233 EdgeInstanceIndex nextId = instance.mNextEdge;
2234
2235 NodeIndex otherNode = mEdgeNodeIndices[edgeId^1];
2236
2237 PxU32 idx = edgeId/2;
2238 IG::Edge& edge = mEdges[edgeId/2];
2239
2240 if(!otherNode.isStaticBody())
2241 {
2242 IslandId islandId = mIslandIds[otherNode.index()];
2243 if(islandId != IG_INVALID_ISLAND)
2244 removeEdgeFromIsland(mIslands[islandId], idx);
2245 }
2246
2247 removeConnectionInternal(idx);
2248 removeConnectionFromGraph(idx);
2249
2250 edge.clearInserted();
2251 if (edge.isActive())
2252 {
2253 edge.deactivateEdge();
2254 removeEdgeFromActivatingList(idx);
2255 mActiveEdgeCount[edge.mEdgeType]--;
2256 }
2257
2258 if(!edge.isPendingDestroyed())
2259 {
2260 if(!edge.isInDirtyList())
2261 {
2262 PX_ASSERT(!contains(mDirtyEdges[edge.mEdgeType], idx));
2263 mDirtyEdges[edge.mEdgeType].pushBack(idx);
2264 edge.markInDirtyList();
2265 }
2266 }
2267 else
2268 {
2269 edge.setReportOnlyDestroy();
2270 }
2271

Callers 1

postSwitchToDynamicMethod · 0.45

Calls 15

PxMaxFunction · 0.85
indexMethod · 0.80
isStaticBodyMethod · 0.80
clearInsertedMethod · 0.80
isPendingDestroyedMethod · 0.80
isInDirtyListMethod · 0.80
markInDirtyListMethod · 0.80
setReportOnlyDestroyMethod · 0.80
containsFunction · 0.70
isKinematicMethod · 0.45
isActiveMethod · 0.45
deactivateEdgeMethod · 0.45

Tested by

no test coverage detected