| 125 | } |
| 126 | |
| 127 | bool NpShapeManager::detachShape(NpShape& s, PxRigidActor& actor, bool wakeOnLostTouch) |
| 128 | { |
| 129 | PX_ASSERT(!mPruningStructure); |
| 130 | |
| 131 | const PxU32 index = mShapes.find(&s); |
| 132 | if(index==0xffffffff) |
| 133 | return false; |
| 134 | |
| 135 | NpScene* scene = NpActor::getAPIScene(actor); |
| 136 | if(scene && isSceneQuery(s)) |
| 137 | { |
| 138 | scene->getSceneQueryManagerFast().removePrunerShape(mSqCompoundId, getPrunerData(index)); |
| 139 | // if this is the last shape of a compound shape, we have to remove the compound id |
| 140 | // and in case of a dynamic actor, remove it from the active list |
| 141 | if(isSqCompound() && (mShapes.getCount() == 1)) |
| 142 | { |
| 143 | mSqCompoundId = INVALID_PRUNERHANDLE; |
| 144 | const PxType actorType = actor.getConcreteType(); |
| 145 | const bool isDynamic = actorType == PxConcreteType::eRIGID_DYNAMIC || actorType == PxConcreteType::eARTICULATION_LINK; |
| 146 | if(isDynamic) |
| 147 | { |
| 148 | // for PxRigidDynamic and PxArticulationLink we need to remove the compound rigid flag and remove them from active list |
| 149 | if(actor.is<PxRigidDynamic>()) |
| 150 | const_cast<NpRigidDynamic&>(static_cast<const NpRigidDynamic&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound(); |
| 151 | else |
| 152 | { |
| 153 | if(actor.is<PxArticulationLink>()) |
| 154 | const_cast<NpArticulationLink&>(static_cast<const NpArticulationLink&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound(); |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | Scb::RigidObject& ro = static_cast<Scb::RigidObject&>(NpActor::getScbFromPxActor(actor)); |
| 161 | ro.onShapeDetach(s.getScbShape(), wakeOnLostTouch, (s.getRefCount() == 1)); |
| 162 | PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager(); |
| 163 | mShapes.replaceWithLast(index, sm); |
| 164 | mSceneQueryData.replaceWithLast(index, sm); |
| 165 | |
| 166 | s.onActorDetach(); |
| 167 | return true; |
| 168 | } |
| 169 | |
| 170 | void NpShapeManager::detachAll(NpScene* scene, const PxRigidActor& actor) |
| 171 | { |
no test coverage detected