本文整理汇总了C++中NxActor::setLinearDamping方法的典型用法代码示例。如果您正苦于以下问题:C++ NxActor::setLinearDamping方法的具体用法?C++ NxActor::setLinearDamping怎么用?C++ NxActor::setLinearDamping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxActor
的用法示例。
在下文中一共展示了NxActor::setLinearDamping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupAttachmentScene
void SetupAttachmentScene()
{
sprintf(gTitleString, "Attachment Demo");
// Create objects in scene
groundPlane = CreateGroundPlane();
NxActor* box1 = CreateBox(NxVec3(-7,12.25,0), NxVec3(2.5,1,1), 0);
NxActor* box2 = CreateBox(NxVec3(0,12.25,0), NxVec3(2.5,1,1), 0);
NxActor* box3 = CreateBox(NxVec3(7,12.25,0), NxVec3(2.5,1,1), 0);
NxActor* attachedBox = CreateBox(NxVec3(-7.2,4.5,1.6), NxVec3(1.25,1,1), 1);
NxActor* attachedSphere = CreateSphere(NxVec3(-0.25,4.0,2.0), 1.3, 1);
NxActor* attachedCapsule = CreateCapsule(NxVec3(9.0,5.5,2.0),2.0, 1, 1);
NxReal damping = 0.3;
attachedBox->setAngularDamping(damping);
attachedBox->setLinearDamping(damping);
attachedSphere->setAngularDamping(damping);
attachedSphere->setLinearDamping(damping);
attachedCapsule->setAngularDamping(damping);
attachedCapsule->setLinearDamping(damping);
NxQuat q;
q.fromAngleAxis(90,NxVec3(0,0,1));
attachedCapsule->setGlobalOrientationQuat(q);
// Cloth
NxClothDesc clothDesc;
clothDesc.globalPose.M.rotX(1.3);
clothDesc.thickness = 0.3;
clothDesc.attachmentResponseCoefficient = 1;
clothDesc.flags |= NX_CLF_BENDING;
clothDesc.flags |= NX_CLF_BENDING_ORTHO;
clothDesc.flags |= NX_CLF_DAMPING | NX_CLF_VISUALIZATION;
if (gHardwareCloth)
clothDesc.flags |= NX_CLF_HARDWARE;
// Cloth attaching to sphere
clothDesc.globalPose.t = NxVec3(0.75,5,2);
MyCloth* regularCloth1 = new MyCloth(gScene, clothDesc, 2, 8, 0.4);
regularCloth1->getNxCloth()->attachToCollidingShapes(NX_CLOTH_ATTACHMENT_TWOWAY);
gCloths.push_back(regularCloth1);
// Cloth attaching to box
clothDesc.globalPose.t = NxVec3(-6.2,5,2);
MyCloth* regularCloth2 = new MyCloth(gScene, clothDesc, 2, 8, 0.4);
regularCloth2->getNxCloth()->attachToCollidingShapes(NX_CLOTH_ATTACHMENT_TWOWAY);
gCloths.push_back(regularCloth2);
// Cloth attaching to capsule
clothDesc.globalPose.t = NxVec3(8.0,5,2);
clothDesc.attachmentTearFactor = 2.0;
MyCloth* regularCloth3 = new MyCloth(gScene, clothDesc, 2, 8, 0.4);
regularCloth3->getNxCloth()->attachToShape(box3->getShapes()[0], NX_CLOTH_ATTACHMENT_TEARABLE);
regularCloth3->getNxCloth()->attachToShape(attachedCapsule->getShapes()[0], NX_CLOTH_ATTACHMENT_TWOWAY);
gCloths.push_back(regularCloth3);
}