| 806 | /////////////////////////////////////////////////////////////////////////////// |
| 807 | |
| 808 | void NpScene::addArticulation(PxArticulationBase& articulation) |
| 809 | { |
| 810 | PX_PROFILE_ZONE("API.addArticulation", getContextId()); |
| 811 | NP_WRITE_CHECK(this); |
| 812 | |
| 813 | PX_CHECK_AND_RETURN(articulation.getNbLinks()>0, "PxScene::addArticulation: empty articulations may not be added to simulation."); |
| 814 | PX_SIMD_GUARD; |
| 815 | |
| 816 | if (this->getFlags() & PxSceneFlag::eENABLE_GPU_DYNAMICS) |
| 817 | { |
| 818 | Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::addArticulation(): Articulations are not currently supported when PxSceneFlag::eENABLE_GPU_DYNAMICS is set!"); |
| 819 | return; |
| 820 | } |
| 821 | |
| 822 | if (getSimulationStage() != Sc::SimulationStage::eCOMPLETE && articulation.getType() == PxArticulationBase::eReducedCoordinate) |
| 823 | { |
| 824 | Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::addArticulation(): this call is not allowed while the simulation is running. Call will be ignored!"); |
| 825 | return; |
| 826 | } |
| 827 | |
| 828 | PxArticulationImpl& npa = *reinterpret_cast<PxArticulationImpl*>(articulation.getImpl()); |
| 829 | |
| 830 | Scb::Articulation& art = npa.getArticulation(); |
| 831 | const Scb::ControlState::Enum cs = art.getControlState(); |
| 832 | if ((cs == Scb::ControlState::eNOT_IN_SCENE) || ((cs == Scb::ControlState::eREMOVE_PENDING) && (art.getScbScene()->getPxScene() == this))) |
| 833 | addArticulationInternal(articulation); |
| 834 | else |
| 835 | Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::addArticulation(): Articulation already assigned to a scene. Call will be ignored!"); |
| 836 | } |
| 837 | |
| 838 | void NpScene::addArticulationInternal(PxArticulationBase& npa) |
| 839 | { |
no test coverage detected