void NpRigidDynamic::setGlobalPose(const PxTransform& pose, bool autowake) { NpScene* scene = NpActor::getAPIScene(*this); #ifdef PX_CHECKED if(scene) scene->checkPositionSanity(*this, pose, "PxRigidDynamic::setGlobalPose"); #endif PX_CHECK_AND_RETURN(pose.isSane(), "NpRigidDynamic::setGlobalPose: pose is not valid."); NP_WRITE_CHECK(NpActor::getOwnerScene(*this)); PxTransform p = pose.getNormalized(); if(scene) { updateDynamicSceneQueryShapes(mShapeManager, scene->getSceneQueryManagerFast()); } PxTransform newPose = p; newPose.q.normalize(); //AM: added to fix 1461 where users read and write orientations for no reason. Scb::Body& b = getScbBodyFast(); PxTransform body2World = newPose * b.getBody2Actor(); b.setBody2World(body2World, false); if(scene && autowake && !(b.getActorFlags() & PxActorFlag::eDISABLE_SIMULATION)) wakeUpInternal(); }
void NpArticulationJoint::setChildPose(const PxTransform& t) { PX_CHECK_AND_RETURN(t.isSane(), "NpArticulationJoint::setChildPose t is not valid."); NP_WRITE_CHECK(getOwnerScene()); mJoint.setChildPose(mChild->getCMassLocalPose().transformInv(t.getNormalized())); }
void NpCloth::setTargetPose(const PxTransform& pose) { NP_WRITE_CHECK(NpActor::getOwnerScene(*this)); PX_CHECK_AND_RETURN(pose.isSane(), "PxCloth::setTargetPose: invalid transform!"); mCloth.setTargetPose(pose.getNormalized()); sendPvdSimpleProperties(); }
void NpArticulationJoint::setParentPose(const PxTransform& t) { PX_CHECK_AND_RETURN(t.isSane(), "NpArticulationJoint::setParentPose t is not valid."); NP_WRITE_CHECK(getOwnerScene()); if(mParent==NULL) return; mJoint.setParentPose(mParent->getCMassLocalPose().transformInv(t.getNormalized())); }
void NpArticulationLink::setCMassLocalPose(const PxTransform& pose) { NP_WRITE_CHECK(NpActor::getOwnerScene(*this)); PX_CHECK_AND_RETURN(pose.isSane(), "PxArticulationLink::setCMassLocalPose: invalid parameter"); PxTransform p = pose.getNormalized(); PxTransform oldpose = getScbBodyFast().getBody2Actor(); PxTransform comShift = p.transformInv(oldpose); NpArticulationLinkT::setCMassLocalPoseInternal(p); if(mInboundJoint) { Scb::ArticulationJoint &j = mInboundJoint->getScbArticulationJoint(); j.setChildPose(comShift.transform(j.getChildPose())); } for(PxU32 i=0; i<mChildLinks.size(); i++) { Scb::ArticulationJoint &j = static_cast<NpArticulationJoint*>(mChildLinks[i]->getInboundJoint())->getScbArticulationJoint(); j.setParentPose(comShift.transform(j.getParentPose())); } }
void NpRigidDynamic::setCMassLocalPose(const PxTransform& pose) { PX_CHECK_AND_RETURN(pose.isSane(), "NpRigidDynamic::setCMassLocalPose pose is not valid."); NP_WRITE_CHECK(NpActor::getOwnerScene(*this)); PxTransform p = pose.getNormalized(); PxTransform oldBody2Actor = getScbBodyFast().getBody2Actor(); NpRigidDynamicT::setCMassLocalPoseInternal(p); Scb::Body& b = getScbBodyFast(); if (b.getFlags() & PxRigidBodyFlag::eKINEMATIC) { PxTransform bodyTarget; if (b.getKinematicTarget(bodyTarget)) { PxTransform actorTarget = bodyTarget * oldBody2Actor.getInverse(); // get old target pose for the actor from the body target setKinematicTargetInternal(actorTarget); } } }
void NpRigidDynamic::setKinematicTarget(const PxTransform& destination) { PX_CHECK_AND_RETURN(destination.isSane(), "NpRigidDynamic::setKinematicTarget: destination is not valid."); NpScene* scene = NpActor::getAPIScene(*this); PX_UNUSED(scene); NP_WRITE_CHECK(NpActor::getOwnerScene(*this)); #ifdef PX_CHECKED if(scene) scene->checkPositionSanity(*this, destination, "PxRigidDynamic::setKinematicTarget"); #endif Scb::Body& b = getScbBodyFast(); PX_UNUSED(b); //0) make sure this is kinematic PX_CHECK_AND_RETURN((b.getFlags() & PxRigidBodyFlag::eKINEMATIC), "RigidDynamic::setKinematicTarget: Body must be kinematic!"); PX_CHECK_AND_RETURN(scene, "RigidDynamic::setKinematicTarget: Body must be in a scene!"); PX_CHECK_AND_RETURN(!(b.getActorFlags() & PxActorFlag::eDISABLE_SIMULATION), "RigidDynamic::setKinematicTarget: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); setKinematicTargetInternal(destination.getNormalized()); }
void D6Joint::setDrivePosition(const PxTransform& pose) { PX_CHECK_AND_RETURN(pose.isSane(), "PxD6Joint::setDrivePosition: pose invalid"); data().drivePosition = pose.getNormalized(); markDirty(); }