Ejemplo n.º 1
0
void FConstraintInstance::UpdateDriveTarget()
{
#if WITH_PHYSX
	if (PxD6Joint* PJoint = GetUnbrokenJoint())
	{
		FQuat OrientationTargetQuat(AngularOrientationTarget);

		PJoint->setDrivePosition(PxTransform(U2PVector(LinearPositionTarget), U2PQuat(OrientationTargetQuat)));
		PJoint->setDriveVelocity(U2PVector(LinearVelocityTarget), U2PVector(RevolutionsToRads(AngularVelocityTarget)));
	}
#endif
}
Ejemplo n.º 2
0
void FConstraintInstance::UpdateDriveTarget()
{
#if WITH_PHYSX
	ExecuteOnUnbrokenJointReadWrite([&] (PxD6Joint* Joint)
	{
		FQuat OrientationTargetQuat(AngularOrientationTarget);

		Joint->setDrivePosition(PxTransform(U2PVector(LinearPositionTarget), U2PQuat(OrientationTargetQuat)));
		Joint->setDriveVelocity(U2PVector(LinearVelocityTarget), U2PVector(RevolutionsToRads(AngularVelocityTarget)));
	});
#endif
}
Ejemplo n.º 3
0
/** Function for setting target angular velocity. */
void FConstraintInstance::SetAngularVelocityTarget(const FVector& InVelTarget)
{
	// If settings are the same, don't do anything.
	if( AngularVelocityTarget == InVelTarget )
	{
		return;
	}

#if WITH_PHYSX
	if (PxD6Joint* Joint = ConstraintData)
	{
		PxVec3 CurrentLinearVel, CurrentAngVel;
		Joint->getDriveVelocity(CurrentLinearVel, CurrentAngVel);

		PxVec3 AngVel = U2PVector(RevolutionsToRads(InVelTarget));
		Joint->setDriveVelocity(CurrentLinearVel, AngVel);
	}
#endif

	AngularVelocityTarget = InVelTarget;
}