| 435 | } |
| 436 | |
| 437 | void BodySim::deactivate() |
| 438 | { |
| 439 | // Deactivate interactions |
| 440 | { |
| 441 | const PxU32 nbInteractions = getActorInteractionCount(); |
| 442 | |
| 443 | for(PxU32 i=0; i<nbInteractions; ++i) |
| 444 | { |
| 445 | Ps::prefetchLine(mInteractions[PxMin(i+1,nbInteractions-1)]); |
| 446 | Interaction* interaction = mInteractions[i]; |
| 447 | |
| 448 | const bool isNotIGControlled = interaction->getType() != InteractionType::eOVERLAP && |
| 449 | interaction->getType() != InteractionType::eMARKER; |
| 450 | |
| 451 | if (interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE) && isNotIGControlled) |
| 452 | { |
| 453 | const bool proceed = deactivateInteraction(interaction); |
| 454 | if (proceed && (interaction->getType() < InteractionType::eTRACKED_IN_SCENE_COUNT)) |
| 455 | getScene().notifyInteractionDeactivated(interaction); |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | // Deactivate body |
| 461 | { |
| 462 | PX_ASSERT((!isKinematic()) || notInScene() || !readInternalFlag(BF_KINEMATIC_MOVED)); // kinematics should only get deactivated when no target is set. |
| 463 | // exception: object gets newly added, then the state change will happen later |
| 464 | BodyCore& core = getBodyCore(); |
| 465 | if(!readInternalFlag(BF_ON_DEATHROW)) |
| 466 | { |
| 467 | // Set velocity to 0. |
| 468 | // Note: this is also fine if the method gets called because the user puts something to sleep (this behavior is documented in the API) |
| 469 | PX_ASSERT(core.getWakeCounter() == 0.0f); |
| 470 | const PxVec3 zero(0.0f); |
| 471 | core.setLinearVelocityInternal(zero); |
| 472 | core.setAngularVelocityInternal(zero); |
| 473 | |
| 474 | setForcesToDefaults(!(mLLBody.mInternalFlags & PxsRigidBody::eDISABLE_GRAVITY)); |
| 475 | } |
| 476 | |
| 477 | if(!isArticulationLink()) // Articulations have their own sleep logic. |
| 478 | getScene().onBodySleep(this); |
| 479 | |
| 480 | if(core.getFlags() & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) |
| 481 | { |
| 482 | PX_ASSERT(getScene().isInPosePreviewList(*this)); |
| 483 | getScene().removeFromPosePreviewList(*this); |
| 484 | } |
| 485 | destroySqBounds(); |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | void BodySim::setActive(bool active, PxU32 infoFlag) |
| 490 | { |
nothing calls this directly
no test coverage detected