| 103 | } |
| 104 | |
| 105 | bool NpShapeManager::detachShape(NpShape& s, PxRigidActor& actor, bool wakeOnLostTouch) |
| 106 | { |
| 107 | PX_ASSERT(!mPruningStructure); |
| 108 | |
| 109 | const PxU32 index = mShapes.find(&s); |
| 110 | if(index==0xffffffff) |
| 111 | return false; |
| 112 | |
| 113 | NpScene* scene = NpActor::getAPIScene(actor); |
| 114 | if(scene && isSceneQuery(s)) |
| 115 | { |
| 116 | scene->getSceneQueryManagerFast().removePrunerShape(mSqCompoundId, getPrunerData(index)); |
| 117 | // if this is the last shape of a compound shape, we have to remove the compound id |
| 118 | // and in case of a dynamic actor, remove it from the active list |
| 119 | if(isSqCompound() && (mShapes.getCount() == 1)) |
| 120 | { |
| 121 | mSqCompoundId = INVALID_PRUNERHANDLE; |
| 122 | const PxType actorType = actor.getConcreteType(); |
| 123 | const bool isDynamic = actorType == PxConcreteType::eRIGID_DYNAMIC || actorType == PxConcreteType::eARTICULATION_LINK; |
| 124 | if(isDynamic) |
| 125 | { |
| 126 | // for PxRigidDynamic and PxArticulationLink we need to remove the compound rigid flag and remove them from active list |
| 127 | if(actor.is<PxRigidDynamic>()) |
| 128 | const_cast<NpRigidDynamic&>(static_cast<const NpRigidDynamic&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound(); |
| 129 | else |
| 130 | { |
| 131 | if(actor.is<PxArticulationLink>()) |
| 132 | const_cast<NpArticulationLink&>(static_cast<const NpArticulationLink&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound(); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | Scb::RigidObject& ro = static_cast<Scb::RigidObject&>(NpActor::getScbFromPxActor(actor)); |
| 139 | ro.onShapeDetach(s.getScbShape(), wakeOnLostTouch, (s.getRefCount() == 1)); |
| 140 | PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager(); |
| 141 | mShapes.replaceWithLast(index, sm); |
| 142 | mSceneQueryData.replaceWithLast(index, sm); |
| 143 | |
| 144 | s.onActorDetach(); |
| 145 | return true; |
| 146 | } |
| 147 | |
| 148 | void NpShapeManager::detachAll(NpScene* scene, const PxRigidActor& actor) |
| 149 | { |
no test coverage detected