| 206 | } |
| 207 | |
| 208 | bool NpAggregate::removeActor(PxActor& actor) |
| 209 | { |
| 210 | NP_WRITE_CHECK(getOwnerScene()); |
| 211 | PX_SIMD_GUARD; |
| 212 | |
| 213 | if(actor.getType() == PxActorType::eARTICULATION_LINK) |
| 214 | { |
| 215 | Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxAggregate: can't remove articulation link, only whole articulations can be removed"); |
| 216 | return false; |
| 217 | } |
| 218 | |
| 219 | // A.B. remove the BVH structure reference if there is and the aggregate was not added to a scene |
| 220 | NpScene* s = getAPIScene(); |
| 221 | if(!s) |
| 222 | { |
| 223 | NpActor& np = NpActor::getFromPxActor(actor); |
| 224 | Gu::BVHStructure* bvhStructure = NULL; |
| 225 | if(np.getConnectors<Gu::BVHStructure>(NpConnectorType::eBvhStructure, &bvhStructure, 1)) |
| 226 | { |
| 227 | np.removeConnector(actor, NpConnectorType::eBvhStructure, bvhStructure, "PxBVHStructure connector could not have been removed!"); |
| 228 | bvhStructure->decRefCount(); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | // PT: there are really 2 cases here: |
| 233 | // a) the user just wants to remove the actor from the aggregate, but the actor is still alive so if the aggregate has been added to a scene, |
| 234 | // we must reinsert the removed actor to that same scene |
| 235 | // b) this is called by the framework when releasing an actor, in which case we don't want to reinsert it anywhere. |
| 236 | // |
| 237 | // We assume that when called by the user, we always want to reinsert. The framework however will call the internal function |
| 238 | // without reinsertion. |
| 239 | return removeActorAndReinsert(actor, true); |
| 240 | } |
| 241 | |
| 242 | bool NpAggregate::addArticulation(PxArticulationBase& art) |
| 243 | { |
no test coverage detected