本文整理汇总了C++中PxRigidDynamic::setMaxDepenetrationVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ PxRigidDynamic::setMaxDepenetrationVelocity方法的具体用法?C++ PxRigidDynamic::setMaxDepenetrationVelocity怎么用?C++ PxRigidDynamic::setMaxDepenetrationVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxRigidDynamic
的用法示例。
在下文中一共展示了PxRigidDynamic::setMaxDepenetrationVelocity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PxCloneDynamic
PxRigidDynamic* PxCloneDynamic(PxPhysics& physicsSDK,
const PxTransform& transform,
const PxRigidDynamic& from)
{
PxRigidDynamic* to = physicsSDK.createRigidDynamic(transform);
if(!to)
return NULL;
copyStaticProperties(physicsSDK, *to, from);
to->setRigidBodyFlags(from.getRigidBodyFlags());
to->setMass(from.getMass());
to->setMassSpaceInertiaTensor(from.getMassSpaceInertiaTensor());
to->setCMassLocalPose(from.getCMassLocalPose());
to->setLinearVelocity(from.getLinearVelocity());
to->setAngularVelocity(from.getAngularVelocity());
to->setLinearDamping(from.getAngularDamping());
to->setAngularDamping(from.getAngularDamping());
PxU32 posIters, velIters;
from.getSolverIterationCounts(posIters, velIters);
to->setSolverIterationCounts(posIters, velIters);
to->setMaxAngularVelocity(from.getMaxAngularVelocity());
to->setMaxDepenetrationVelocity(from.getMaxDepenetrationVelocity());
to->setSleepThreshold(from.getSleepThreshold());
to->setStabilizationThreshold(from.getStabilizationThreshold());
to->setMinCCDAdvanceCoefficient(from.getMinCCDAdvanceCoefficient());
to->setContactReportThreshold(from.getContactReportThreshold());
to->setMaxContactImpulse(from.getMaxContactImpulse());
return to;
}
示例2: SetUpPhysicsHandle
bool UGripMotionControllerComponent::SetUpPhysicsHandle(const FBPActorGripInformation &NewGrip)
{
UPrimitiveComponent *root = NewGrip.Component;
if(!root)
root = Cast<UPrimitiveComponent>(NewGrip.Actor->GetRootComponent());
if (!root)
return false;
// Needs to be simulating in order to run physics
root->SetSimulatePhysics(true);
root->SetEnableGravity(false);
FBPActorPhysicsHandleInformation * HandleInfo = CreatePhysicsGrip(NewGrip);
#if WITH_PHYSX
// Get the PxRigidDynamic that we want to grab.
FBodyInstance* BodyInstance = root->GetBodyInstance(NAME_None/*InBoneName*/);
if (!BodyInstance)
{
return false;
}
ExecuteOnPxRigidDynamicReadWrite(BodyInstance, [&](PxRigidDynamic* Actor)
{
PxScene* Scene = Actor->getScene();
// Get transform of actor we are grabbing
FTransform WorldTransform;
FTransform InverseTransform = this->GetComponentTransform().Inverse();
WorldTransform = NewGrip.RelativeTransform.GetRelativeTransform(InverseTransform);
PxVec3 KinLocation = U2PVector(WorldTransform.GetLocation() - (WorldTransform.GetLocation() - root->GetComponentLocation()));
PxTransform GrabbedActorPose = Actor->getGlobalPose();
PxTransform KinPose(KinLocation, GrabbedActorPose.q);
// set target and current, so we don't need another "Tick" call to have it right
//TargetTransform = CurrentTransform = P2UTransform(KinPose);
// If we don't already have a handle - make one now.
if (!HandleInfo->HandleData)
{
// Create kinematic actor we are going to create joint with. This will be moved around with calls to SetLocation/SetRotation.
PxRigidDynamic* KinActor = Scene->getPhysics().createRigidDynamic(KinPose);
KinActor->setRigidDynamicFlag(PxRigidDynamicFlag::eKINEMATIC, true);
KinActor->setMass(0.0f); // 1.0f;
KinActor->setMassSpaceInertiaTensor(PxVec3(0.0f, 0.0f, 0.0f));// PxVec3(1.0f, 1.0f, 1.0f));
KinActor->setMaxDepenetrationVelocity(PX_MAX_F32);
// No bodyinstance
KinActor->userData = NULL;
// Add to Scene
Scene->addActor(*KinActor);
// Save reference to the kinematic actor.
HandleInfo->KinActorData = KinActor;
// Create the joint
PxVec3 LocalHandlePos = GrabbedActorPose.transformInv(KinLocation);
PxD6Joint* NewJoint = PxD6JointCreate(Scene->getPhysics(), KinActor, PxTransform::createIdentity(), Actor, PxTransform(LocalHandlePos));
if (!NewJoint)
{
HandleInfo->HandleData = 0;
}
else
{
// No constraint instance
NewJoint->userData = NULL;
HandleInfo->HandleData = NewJoint;
// Remember the scene index that the handle joint/actor are in.
FPhysScene* RBScene = FPhysxUserData::Get<FPhysScene>(Scene->userData);
const uint32 SceneType = root->BodyInstance.UseAsyncScene(RBScene) ? PST_Async : PST_Sync;
HandleInfo->SceneIndex = RBScene->PhysXSceneIndex[SceneType];
// Setting up the joint
NewJoint->setMotion(PxD6Axis::eX, PxD6Motion::eFREE);
NewJoint->setMotion(PxD6Axis::eY, PxD6Motion::eFREE);
NewJoint->setMotion(PxD6Axis::eZ, PxD6Motion::eFREE);
NewJoint->setDrivePosition(PxTransform(PxVec3(0, 0, 0)));
NewJoint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE);
NewJoint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE);
NewJoint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE);
//UpdateDriveSettings();
if (HandleInfo->HandleData != nullptr)
{
HandleInfo->HandleData->setDrive(PxD6Drive::eX, PxD6JointDrive(NewGrip.Stiffness, NewGrip.Damping, PX_MAX_F32, PxD6JointDriveFlag::eACCELERATION));
HandleInfo->HandleData->setDrive(PxD6Drive::eY, PxD6JointDrive(NewGrip.Stiffness, NewGrip.Damping, PX_MAX_F32, PxD6JointDriveFlag::eACCELERATION));
HandleInfo->HandleData->setDrive(PxD6Drive::eZ, PxD6JointDrive(NewGrip.Stiffness, NewGrip.Damping, PX_MAX_F32, PxD6JointDriveFlag::eACCELERATION));
HandleInfo->HandleData->setDrive(PxD6Drive::eSLERP, PxD6JointDrive(NewGrip.Stiffness, NewGrip.Damping, PX_MAX_F32, PxD6JointDriveFlag::eACCELERATION));
//HandleData->setDrive(PxD6Drive::eTWIST, PxD6JointDrive(Stiffness, Damping, PX_MAX_F32, PxD6JointDriveFlag::eACCELERATION));
//HandleData->setDrive(PxD6Drive::eSWING, PxD6JointDrive(Stiffness, Damping, PX_MAX_F32, PxD6JointDriveFlag::eACCELERATION));
}
//.........这里部分代码省略.........