本文整理汇总了C++中NxScene::createMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ NxScene::createMaterial方法的具体用法?C++ NxScene::createMaterial怎么用?C++ NxScene::createMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxScene
的用法示例。
在下文中一共展示了NxScene::createMaterial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
{
sceneDesc.flags |= NX_SF_RESTRICTED_SCENE;
}
}
else
{
sceneDesc.simType = NX_SIMULATION_SW;
}
if (!useMultithreading)
{
// Disable threading
sceneDesc.flags = 0;
}
runningInHardware = useHardware;
sceneDesc.flags |= NX_SF_ENABLE_ACTIVETRANSFORMS;
scene = sdk->createScene(sceneDesc);
if(scene)
{
NxMaterial *defaultMaterial = scene->getMaterialFromIndex(0);
defaultMaterial->setStaticFriction(params->defaultStaticFriction);
defaultMaterial->setDynamicFriction(params->defaultDynamicFriction);
defaultMaterial->setRestitution(params->defaultRestitution);
#ifdef PROJECT_CLAW_PROTO
// Create material for cops (larger friction, no restitution)
NxMaterialDesc materialDesc;
materialDesc.restitution = 0.0f;
materialDesc.restitutionCombineMode = NX_CM_MIN;
materialDesc.staticFriction = 10.0f;
materialDesc.dynamicFriction = 10.0f;
unitMaterial = scene->createMaterial(materialDesc);
#endif
sdk->setParameter(NX_VISUALIZATION_SCALE, 1.f);
#ifndef PROJECT_SHADOWGROUNDS
sdk->setParameter(NX_SKIN_WIDTH, 0.01f);
#endif
// NEW: the new scriptable collision/contact group initialization
int contactFlags1 = NX_NOTIFY_ON_START_TOUCH | NX_NOTIFY_ON_TOUCH | NX_NOTIFY_FORCES;
#ifdef PHYSICS_FEEDBACK
int contactFlags2 = NX_NOTIFY_ON_START_TOUCH | NX_NOTIFY_ON_TOUCH | NX_NOTIFY_FORCES;
#else
int contactFlags2 = NX_NOTIFY_ON_START_TOUCH | NX_NOTIFY_FORCES;
#endif
if (params->scriptRunner != NULL)
{
bool ok = params->scriptRunner->runPhysicsLibScript("physics_init", "set_contacts");
if (!ok)
::Logger::getInstance()->error("PhysicsLib - Failed to run physics_init:set_contacts script (script/sub may not be loaded or did not return expected value).");
}
for (int i = 0; i < PHYSICS_MAX_COLLISIONGROUPS; i++)
{
for (int j = 0; j < PHYSICS_MAX_COLLISIONGROUPS; j++)
{
if (physicslib_group_cont[i][j] != physicslib_group_cont[j][i])
{
::Logger::getInstance()->error("PhysicsLib - Improperly mirrored physics contacts data (group1 -> group2 does not have same flag as group2 -> group1).");
::Logger::getInstance()->debug("contacts data group numbers follow:");
::Logger::getInstance()->debug(int2str(i));
::Logger::getInstance()->debug(int2str(j));