当前位置: 首页>>代码示例>>C++>>正文


C++ NxActor::setCMassOffsetLocalPosition方法代码示例

本文整理汇总了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;
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:77,代码来源:Lesson703.cpp


注:本文中的NxActor::setCMassOffsetLocalPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。