PxArticulationDriveCache* NpArticulation::createDriveCache(PxReal compliance, PxU32 driveIterations) const { PX_CHECK_AND_RETURN_NULL(getAPIScene(), "PxArticulation::createDriveCache: object must be in a scene"); NP_READ_CHECK(getOwnerScene()); // doesn't modify the scene, only reads return reinterpret_cast<PxArticulationDriveCache*>(mArticulation.getScArticulation().createDriveCache(compliance, driveIterations)); }
void NpArticulation::releaseDriveCache(PxArticulationDriveCache&cache ) const { PX_CHECK_AND_RETURN(getAPIScene(), "PxArticulation::releaseDriveCache: object must be in a scene"); NP_READ_CHECK(getOwnerScene()); // doesn't modify the scene, only reads mArticulation.getScArticulation().releaseDriveCache(reinterpret_cast<Sc::ArticulationDriveCache&>(cache)); }
bool NpArticulation::isSleeping() const { NP_READ_CHECK(getOwnerScene()); PX_CHECK_AND_RETURN_VAL(getAPIScene(), "Articulation::isSleeping: articulation must be in a scene.", true); return getArticulation().isSleeping(); }
void NpArticulation::getSolverIterationCounts(PxU32 & positionIters, PxU32 & velocityIters) const { NP_READ_CHECK(getOwnerScene()); PxU16 x = getArticulation().getSolverIterationCounts(); velocityIters = PxU32(x >> 8); positionIters = PxU32(x & 0xff); }
void NpArticulation::updateDriveCache(PxArticulationDriveCache& cache, PxReal compliance, PxU32 driveIterations) const { PX_CHECK_AND_RETURN(getAPIScene(), "PxArticulation::updateDriveCache: object must be in a scene"); Sc::ArticulationDriveCache& c = reinterpret_cast<Sc::ArticulationDriveCache&>(cache); PX_CHECK_AND_RETURN(mArticulation.getScArticulation().getCacheLinkCount(c) == mArticulationLinks.size(), "PxArticulation::updateDriveCache: Articulation size has changed; drive cache is invalid"); NP_READ_CHECK(getOwnerScene()); // doesn't modify the scene, only reads mArticulation.getScArticulation().updateDriveCache(c, compliance, driveIterations); }
PxU32 NpArticulation::getLinks(PxArticulationLink** buffer, PxU32 bufferSize) const { NP_READ_CHECK(getOwnerScene()); const PxU32 size = mArticulationLinks.size(); const PxU32 writeCount = PxMin(size, bufferSize); for(PxU32 i=0; i<writeCount; i++) buffer[i] = mArticulationLinks[i]; return writeCount; // return Ps::dumpPointerArray((const void**)mArticulationLinks.begin(), mArticulationLinks.size(), (void**)buffer, bufferSize); }
PxBounds3 NpArticulation::getWorldBounds(float inflation) const { NP_READ_CHECK(getOwnerScene()); PxBounds3 bounds = PxBounds3::empty(); for(PxU32 i=0; i < mArticulationLinks.size(); i++) { bounds.include(mArticulationLinks[i]->getWorldBounds()); } PX_ASSERT(bounds.isValid()); // PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents. const PxVec3 center = bounds.getCenter(); const PxVec3 inflatedExtents = bounds.getExtents() * inflation; return PxBounds3::centerExtents(center, inflatedExtents); }
void NpArticulation::computeImpulseResponse(PxArticulationLink* link, PxVec3& linearResponse, PxVec3& angularResponse, const PxArticulationDriveCache& driveCache, const PxVec3& force, const PxVec3& torque) const { PX_CHECK_AND_RETURN(getAPIScene(), "PxArticulation::computeImpulseResponse: object must be in a scene"); PX_CHECK_AND_RETURN(force.isFinite() && torque.isFinite(), "PxArticulation::computeImpulseResponse: invalid force/torque"); NP_READ_CHECK(getOwnerScene()); const Sc::ArticulationDriveCache& c = reinterpret_cast<const Sc::ArticulationDriveCache&>(driveCache); PX_CHECK_AND_RETURN(mArticulation.getScArticulation().getCacheLinkCount(c) == mArticulationLinks.size(), "PxArticulation::computeImpulseResponse: Articulation size has changed; drive cache is invalid"); PX_UNUSED(&c); mArticulation.getScArticulation().computeImpulseResponse(static_cast<NpArticulationLink*>(link)->getScbBodyFast().getScBody(), linearResponse, angularResponse, reinterpret_cast<const Sc::ArticulationDriveCache&>(driveCache), force, torque); }
const char* NpArticulation::getName() const { NP_READ_CHECK(getOwnerScene()); return mName; }
PxReal NpArticulationJoint::getExternalCompliance() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getExternalCompliance(); }
PxAggregate* NpArticulation::getAggregate() const { NP_READ_CHECK(getOwnerScene()); return mAggregate; }
PxU32 NpArticulation::getNbLinks() const { NP_READ_CHECK(getOwnerScene()); return mArticulationLinks.size(); }
void NpArticulationJoint::getSwingLimit(PxReal &yLimit, PxReal &zLimit) const { NP_READ_CHECK(getOwnerScene()); mJoint.getSwingLimit(yLimit, zLimit); }
PxVec3 NpArticulationJoint::getTargetVelocity() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getTargetVelocity(); }
bool NpArticulationJoint::getTwistLimitEnabled() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getTwistLimitEnabled(); }
PxReal NpArticulationJoint::getTangentialDamping() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getTangentialDamping(); }
PxReal NpArticulation::getSleepThreshold() const { NP_READ_CHECK(getOwnerScene()); return getArticulation().getSleepThreshold(); }
PxReal NpArticulation::getSeparationTolerance() const { NP_READ_CHECK(getOwnerScene()); return getArticulation().getSeparationTolerance(); }
PxArticulationJointDriveType::Enum NpArticulationJoint::getDriveType() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getDriveType(); }
PxU32 NpArticulation::getMaxProjectionIterations() const { NP_READ_CHECK(getOwnerScene()); return getArticulation().getMaxProjectionIterations(); }
PxU32 NpArticulation::getExternalDriveIterations() const { NP_READ_CHECK(getOwnerScene()); return getArticulation().getExternalDriveIterations(); }
PxTransform NpArticulationJoint::getParentPose() const { NP_READ_CHECK(getOwnerScene()); return mParent->getCMassLocalPose().transform(mJoint.getParentPose()); }
PxReal NpArticulationJoint::getTwistLimitContactDistance() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getTwistLimitContactDistance(); }
PxReal NpArticulation::getStabilizationThreshold() const { NP_READ_CHECK(getOwnerScene()); return getArticulation().getFreezeThreshold(); }
PxReal NpArticulationJoint::getStiffness() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getStiffness(); }
PxReal NpArticulation::getWakeCounter() const { NP_READ_CHECK(getOwnerScene()); return getArticulation().getWakeCounter(); }
PxQuat NpArticulationJoint::getTargetOrientation() const { NP_READ_CHECK(getOwnerScene()); return mJoint.getTargetOrientation(); }
void NpArticulationJoint::getTwistLimit(PxReal &lower, PxReal &upper) const { NP_READ_CHECK(getOwnerScene()); mJoint.getTwistLimit(lower, upper); }