本文整理汇总了C++中NxActor::setCMassOffsetLocalPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ NxActor::setCMassOffsetLocalPosition方法的具体用法?C++ NxActor::setCMassOffsetLocalPosition怎么用?C++ NxActor::setCMassOffsetLocalPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxActor
的用法示例。
在下文中一共展示了NxActor::setCMassOffsetLocalPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTrike
NxActor* CreateTrike(const NxVec3& pos)
{
NxActor* actor = CreateBox(pos + NxVec3(0,0.5,0), NxVec3(2,0.25,0.75), 10);
NxTireFunctionDesc lngTFD;
lngTFD.extremumSlip = 1.0f;
lngTFD.extremumValue = 0.02f;
lngTFD.asymptoteSlip = 2.0f;
lngTFD.asymptoteValue = 0.01f;
lngTFD.stiffnessFactor = 1000000.0f;
NxTireFunctionDesc latTFD;
latTFD.extremumSlip = 1.0f;
latTFD.extremumValue = 0.02f;
latTFD.asymptoteSlip = 2.0f;
latTFD.asymptoteValue = 0.01f;
latTFD.stiffnessFactor = 1000000.0f;
NxTireFunctionDesc slipTFD;
slipTFD.extremumSlip = 1.0f;
slipTFD.extremumValue = 0.02f;
slipTFD.asymptoteSlip = 2.0f;
slipTFD.asymptoteValue = 0.01f;
slipTFD.stiffnessFactor = 100.0f;
// Front wheel
NxWheelDesc wheelDesc;
wheelDesc.wheelApproximation = 10;
wheelDesc.wheelRadius = 0.5;
wheelDesc.wheelWidth = 0.3; // 0.1
wheelDesc.wheelSuspension = 1.0;
wheelDesc.springRestitution = 100;
wheelDesc.springDamping = 0.5;
wheelDesc.springBias = 0;
wheelDesc.maxBrakeForce = 1;
wheelDesc.position = NxVec3(2.5,0.5,0);
wheelDesc.wheelFlags = NX_WF_USE_WHEELSHAPE | NX_WF_BUILD_LOWER_HALF | NX_WF_ACCELERATED |
NX_WF_AFFECTED_BY_HANDBRAKE | NX_WF_STEERABLE_INPUT;
wheel1 = AddWheelToActor(actor, &wheelDesc);
// Rear left wheel
NxWheelDesc wheelDesc2;
wheelDesc2.wheelApproximation = 10;
wheelDesc2.wheelRadius = 0.5;
wheelDesc2.wheelWidth = 0.3; // 0.1
wheelDesc2.wheelSuspension = 1.0;
wheelDesc2.springRestitution = 100;
wheelDesc2.springDamping = 0.5;
wheelDesc2.springBias = 0;
wheelDesc2.maxBrakeForce = 1;
wheelDesc2.position = NxVec3(-1.5,0.5,-1);
wheelDesc2.wheelFlags = NX_WF_USE_WHEELSHAPE | NX_WF_BUILD_LOWER_HALF | NX_WF_ACCELERATED |
NX_WF_AFFECTED_BY_HANDBRAKE | NX_WF_STEERABLE_INPUT;
wheel2 = AddWheelToActor(actor, &wheelDesc2);
// Rear right wheel
NxWheelDesc wheelDesc3;
wheelDesc3.wheelApproximation = 10;
wheelDesc3.wheelRadius = 0.5;
wheelDesc3.wheelWidth = 0.3; // 0.1
wheelDesc3.wheelSuspension = 1.0;
wheelDesc3.springRestitution = 100;
wheelDesc3.springDamping = 0.5;
wheelDesc3.springBias = 0;
wheelDesc3.maxBrakeForce = 1;
wheelDesc3.position = NxVec3(-1.5,0.5,1);
wheelDesc3.wheelFlags = NX_WF_USE_WHEELSHAPE | NX_WF_BUILD_LOWER_HALF | NX_WF_ACCELERATED |
NX_WF_AFFECTED_BY_HANDBRAKE | NX_WF_STEERABLE_INPUT;
wheel3 = AddWheelToActor(actor, &wheelDesc3);
// LOWER THE CENTER OF MASS
NxVec3 massPos = actor->getCMassLocalPosition();
massPos.y -= 1;
actor->setCMassOffsetLocalPosition(massPos);
return actor;
}