本文整理汇总了C++中PxRigidDynamic::setMaxAngularVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ PxRigidDynamic::setMaxAngularVelocity方法的具体用法?C++ PxRigidDynamic::setMaxAngularVelocity怎么用?C++ PxRigidDynamic::setMaxAngularVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxRigidDynamic
的用法示例。
在下文中一共展示了PxRigidDynamic::setMaxAngularVelocity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PxCloneDynamic
PxRigidDynamic* PxCloneDynamic(PxPhysics& physicsSDK,
const PxTransform& transform,
const PxRigidDynamic& from)
{
PxRigidDynamic* to = physicsSDK.createRigidDynamic(transform);
if(!to)
return NULL;
copyStaticProperties(*to, from);
to->setRigidDynamicFlags(from.getRigidDynamicFlags());
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());
to->setMaxAngularVelocity(from.getMaxAngularVelocity());
PxU32 posIters, velIters;
from.getSolverIterationCounts(posIters, velIters);
to->setSolverIterationCounts(posIters, velIters);
to->setSleepThreshold(from.getSleepThreshold());
to->setContactReportThreshold(from.getContactReportThreshold());
return to;
}
示例2: CloneDynamic
PxRigidDynamic* CloneDynamic(PxPhysics& physicsSDK,
const PxTransform& transform,
const PxRigidDynamic& from,
NxMirrorScene::MirrorFilter &mirrorFilter)
{
PxRigidDynamic* to = physicsSDK.createRigidDynamic(transform);
if(!to)
return NULL;
if ( !copyStaticProperties(*to, from, mirrorFilter) )
{
to->release();
to = NULL;
return NULL;
}
to->setRigidDynamicFlags(from.getRigidDynamicFlags());
to->setMass(from.getMass());
to->setMassSpaceInertiaTensor(from.getMassSpaceInertiaTensor());
to->setCMassLocalPose(from.getCMassLocalPose());
if ( !(to->getRigidDynamicFlags() & PxRigidDynamicFlag::eKINEMATIC) )
{
to->setLinearVelocity(from.getLinearVelocity());
to->setAngularVelocity(from.getAngularVelocity());
}
to->setLinearDamping(from.getAngularDamping());
to->setAngularDamping(from.getAngularDamping());
to->setMaxAngularVelocity(from.getMaxAngularVelocity());
PxU32 posIters, velIters;
from.getSolverIterationCounts(posIters, velIters);
to->setSolverIterationCounts(posIters, velIters);
to->setSleepThreshold(from.getSleepThreshold());
to->setContactReportThreshold(from.getContactReportThreshold());
return to;
}
示例3: createEntity
// Creates an physics entity from an entity info structure and a starting transform
void PhysicsEngine::createEntity(PhysicsEntity* entity, PhysicsEntityInfo* info, PxTransform transform)
{
transform.p.y += info->yPosOffset;
// Set static/dynamic info for actor depending on its type
PxRigidActor* actor;
if (info->type == PhysicsType::DYNAMIC)
{
DynamicInfo* dInfo = info->dynamicInfo;
PxRigidDynamic* dynamicActor = physics->createRigidDynamic(transform);
dynamicActor->setLinearDamping(dInfo->linearDamping);
dynamicActor->setAngularDamping(dInfo->angularDamping);
dynamicActor->setMaxAngularVelocity(dInfo->maxAngularVelocity);
actor = dynamicActor;
}
else if (info->type == PhysicsType::STATIC)
{
PxRigidStatic* staticActor = physics->createRigidStatic(transform);
actor = staticActor;
}
// All shapes in actor
for (auto sInfo : info->shapeInfo)
{
// Create material and geometry for shape and add it to actor
PxGeometry* geometry;
PxMaterial* material;
if (sInfo->geometry == Geometry::SPHERE)
{
SphereInfo* sphInfo = (SphereInfo*)sInfo;
geometry = new PxSphereGeometry(sphInfo->radius);
}
else if (sInfo->geometry == Geometry::BOX)
{
BoxInfo* boxInfo = (BoxInfo*)sInfo;
geometry = new PxBoxGeometry(boxInfo->halfX, boxInfo->halfY, boxInfo->halfZ);
}
else if (sInfo->geometry == Geometry::CAPSULE)
{
CapsuleInfo* capInfo = (CapsuleInfo*)sInfo;
geometry = new PxCapsuleGeometry(capInfo->radius, capInfo->halfHeight);
}
else if (sInfo->geometry == Geometry::CONVEX_MESH)
{
ConvexMeshInfo* cmInfo = (ConvexMeshInfo*)sInfo;
PxConvexMesh* mesh = helper->createConvexMesh(cmInfo->verts.data(), cmInfo->verts.size());
geometry = new PxConvexMeshGeometry(mesh);
}
// Not working until index drawing is set up
else if (sInfo->geometry == Geometry::TRIANGLE_MESH)
{
TriangleMeshInfo* tmInfo = (TriangleMeshInfo*)sInfo;
PxTriangleMesh* mesh = helper->createTriangleMesh(tmInfo->verts.data(), tmInfo->verts.size(), tmInfo->faces.data(), tmInfo->faces.size()/3);
geometry = new PxTriangleMeshGeometry(mesh);
}
material = (sInfo->isDrivable) ? drivingSurfaces[0] : physics->createMaterial(sInfo->dynamicFriction, sInfo->staticFriction, sInfo->restitution);
PxShape* shape = actor->createShape(*geometry, *material); // TODO support shape flags
shape->setLocalPose(sInfo->transform);
material->release();
delete geometry;
// Set up querry filter data for shape
PxFilterData qryFilterData;
qryFilterData.word3 = (sInfo->isDrivable) ? (PxU32)Surface::DRIVABLE : (PxU32)Surface::UNDRIVABLE;
shape->setQueryFilterData(qryFilterData);
// Set up simulation filter data for shape
PxFilterData simFilterData;
simFilterData.word0 = (PxU32)sInfo->filterFlag0;
simFilterData.word1 = (PxU32)sInfo->filterFlag1;
simFilterData.word2 = (PxU32)sInfo->filterFlag2;
simFilterData.word3 = (PxU32)sInfo->filterFlag3;
shape->setSimulationFilterData(simFilterData);
if (info->type == PhysicsType::DYNAMIC)
{
DynamicInfo* dInfo = info->dynamicInfo;
PxRigidBodyExt::updateMassAndInertia(*(PxRigidBody*)actor, dInfo->density, &dInfo->cmOffset);
PxRigidBody* body = (PxRigidBody*)actor;
}
}
// Add actor to scene, set actor for entity, and set user data for actor. Creates one to one between entities and phyX
scene->addActor(*actor);
entity->setActor(actor);
actor->userData = entity;
}