本文整理汇总了C++中PxPhysics::getTolerancesScale方法的典型用法代码示例。如果您正苦于以下问题:C++ PxPhysics::getTolerancesScale方法的具体用法?C++ PxPhysics::getTolerancesScale怎么用?C++ PxPhysics::getTolerancesScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxPhysics
的用法示例。
在下文中一共展示了PxPhysics::getTolerancesScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sceneDesc
void
PhsXWorld::build(void) {
PxTolerancesScale scale = PxTolerancesScale();
PxFoundation* gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback);
PxProfileZoneManager* profileZoneManager = &PxProfileZoneManager::createProfileZoneManager(gFoundation);
PxPhysics* gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, scale, true, profileZoneManager);
if (gPhysics->getPvdConnectionManager()) {
gPhysics->getVisualDebugger()->setVisualizeConstraints(true);
gPhysics->getVisualDebugger()->setVisualDebuggerFlag(PxVisualDebuggerFlag::eTRANSMIT_CONTACTS, true);
gPhysics->getVisualDebugger()->setVisualDebuggerFlag(PxVisualDebuggerFlag::eTRANSMIT_SCENEQUERIES, true);
//gPhysics->getVisualDebugger()->setVisualDebuggerFlag(PxVisualDebuggerFlag::eTRANSMIT_CONSTRAINTS, true);
gConnection = PxVisualDebuggerExt::createConnection(gPhysics->getPvdConnectionManager(), "127.0.0.1", 5425, 100);
}
PxSceneDesc sceneDesc(gPhysics->getTolerancesScale());
sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f);
PxDefaultCpuDispatcher* gDispatcher = PxDefaultCpuDispatcherCreate(2);
sceneDesc.cpuDispatcher = gDispatcher;
sceneDesc.filterShader = PxDefaultSimulationFilterShader;
sceneDesc.flags |= PxSceneFlag::eENABLE_ACTIVETRANSFORMS;
m_pDynamicsWorld = gPhysics->createScene(sceneDesc);
//m_pDynamicsWorld->setFlag(PxSceneFlag::eENABLE_ACTIVETRANSFORMS, true);
mCooking = PxCreateCooking(PX_PHYSICS_VERSION, *gFoundation, PxCookingParams(scale));
manager = PxCreateControllerManager(*m_pDynamicsWorld);
std::srand(time(NULL));
}
示例2: PxInitVehicleSDK
bool PxInitVehicleSDK(PxPhysics& physics)
{
PX_ASSERT(static_cast<Ps::Foundation*>(&physics.getFoundation()) == &Ps::Foundation::getInstance());
Ps::Foundation::incRefCount();
setVehicleToleranceScale(physics.getTolerancesScale());
return true;
}
示例3: InitPhysX
void InitPhysX() {
gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gDefaultAllocatorCallback, gDefaultErrorCallback);
gPhysicsSDK = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale() );
if(gPhysicsSDK == NULL) {
cerr<<"Error create PhysX."<<endl;
}
PxSceneDesc sceneDesc(gPhysicsSDK->getTolerancesScale());
sceneDesc.gravity = PxVec3(0.0f, -9.8f, 0.0f);
sceneDesc.cpuDispatcher = PxDefaultCpuDispatcherCreate(1);
sceneDesc.filterShader = PxDefaultSimulationFilterShader;
gScene = gPhysicsSDK->createScene(sceneDesc);
PxMaterial* material = gPhysicsSDK->createMaterial(0.5,0.5,0.5);
PxTransform planePos = PxTransform(PxVec3(0.0f),PxQuat(PxHalfPi, PxVec3(0.0f, 0.0f, 1.0f)));
PxRigidStatic* plane = gPhysicsSDK->createRigidStatic(planePos);
plane->createShape(PxPlaneGeometry(), *material);
gScene->addActor(*plane);
PxTransform boxPos(PxVec3(0.0f, 10.0f, 0.0f));
PxBoxGeometry boxGeometry(PxVec3(2,2,2));
gBox = PxCreateDynamic(*gPhysicsSDK, boxPos, boxGeometry, *material, 1.0f);
gScene->addActor(*gBox);
}