Esempio n. 1
0
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 NpArticulationLink::setGlobalPose(const PxTransform& pose, bool autowake)
{
	NpScene* scene = NpActor::getOwnerScene(*this);

	PX_CHECK_AND_RETURN(pose.isValid(), "NpArticulationLink::setGlobalPose pose is not valid.");

	NP_WRITE_CHECK(scene);
	
#if PX_CHECKED
	if(scene)
		scene->checkPositionSanity(*this, pose, "PxArticulationLink::setGlobalPose");
#endif

	PxTransform body2World = pose * getScbBodyFast().getBody2Actor();
	getScbBodyFast().setBody2World(body2World, false);

	if (scene && autowake)
		mRoot->wakeUpInternal(false, true);
}
Esempio n. 3
0
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());
}