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


C++ NxMat33::rotY方法代码示例

本文整理汇总了C++中NxMat33::rotY方法的典型用法代码示例。如果您正苦于以下问题:C++ NxMat33::rotY方法的具体用法?C++ NxMat33::rotY怎么用?C++ NxMat33::rotY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NxMat33的用法示例。


在下文中一共展示了NxMat33::rotY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ApplyVelocityToActor

NxVec3 ApplyVelocityToActor(NxActor* actor, const NxVec3& velDir, const NxReal velStrength, bool velMode)
{
	NxVec3 velVec = velStrength*velDir;

	if (velMode) 
	{
		actor->moveGlobalPosition(actor->getGlobalPosition() + 0.0001*velStrength*velDir);
	} 
	else 
	{
		NxMat33 orient = actor->getGlobalOrientation();
        NxMat33 m;

		m.id();

		if (velDir == NxVec3(1,0,0))
           m.rotX(0.01);
		else if (velDir == NxVec3(-1,0,0))
           m.rotX(-0.01);
		else if (velDir == NxVec3(0,1,0))
           m.rotY(0.01);
		else if (velDir == NxVec3(0,-1,0))
           m.rotY(-0.01);
		else if (velDir == NxVec3(0,0,1))
           m.rotZ(0.01);
		else if (velDir == NxVec3(0,0,-1))
           m.rotZ(-0.01);

		orient = m * orient;

		actor->moveGlobalOrientation(orient);
	}

	return velVec;
}
开发者ID:1suming,项目名称:pap2,代码行数:35,代码来源:CommonCode.cpp

示例2: CreateCar

NxActor* CreateCar(const NxVec3& pos)
{
	// Create body
	NxBodyDesc bodyDesc;
	NxBoxShapeDesc boxDesc;
	NxCapsuleShapeDesc capsuleDesc[4];
	NxActorDesc actorDesc;

	bodyDesc.mass = carMass;

	const NxReal height = 0.3;
	const NxReal width = 2;
	const NxReal length = 4;

	//boxDesc.dimensions.set(length*0.65, height*0.85, width*0.65);
	//actorDesc.shapes.pushBack(&boxDesc);

	{
		sObject* pObject = dbGetObject ( 5 );
	
		float fXPos	 = pObject->position.vecPosition.x;
		float fYPos	 = pObject->position.vecPosition.y;
		float fZPos	 = pObject->position.vecPosition.z;
		float fXSize = ( pObject->collision.vecMax.x - pObject->collision.vecMin.x ) * pObject->position.vecScale.x;
		float fYSize = ( pObject->collision.vecMax.y - pObject->collision.vecMin.y ) * pObject->position.vecScale.y;
		float fZSize = ( pObject->collision.vecMax.z - pObject->collision.vecMin.z ) * pObject->position.vecScale.z;

		boxDesc.dimensions.set ( fXSize / 2, fYSize / 2, fZSize / 2 );
		boxDesc.localPose.t = NxVec3 ( pObject->collision.vecCentre.x, pObject->collision.vecCentre.y, pObject->collision.vecCentre.z  );
		//boxDesc.localPose.
		actorDesc.shapes.pushBack ( &boxDesc );
	}

	capsuleDesc[0].radius = 0.1;
	capsuleDesc[0].height = 1;
	capsuleDesc[0].flags = NX_SWEPT_SHAPE;
	capsuleDesc[0].localPose.M.setColumn(1, NxVec3(0,-1, 0));
	capsuleDesc[0].localPose.M.setColumn(2, NxVec3(0, 0,-1));	//rotate 180 degrees around x axis to cast downward!
	capsuleDesc[0].localPose.t.set(length*0.5, -height, width*0.5);
	capsuleDesc[0].materialIndex = raycastWheelMaterialIndex;
	capsuleDesc[0].userData = &(wheelUserDatas[0]);
	actorDesc.shapes.pushBack(&capsuleDesc[0]);
	wheelUserDatas[0].frontWheel = true;

	capsuleDesc[1].radius = capsuleDesc[0].radius;
	capsuleDesc[1].height = capsuleDesc[0].height;
	capsuleDesc[1].flags = capsuleDesc[0].flags;
	capsuleDesc[1].localPose.M = capsuleDesc[0].localPose.M;	
	capsuleDesc[1].localPose.t.set(length*0.5, -height, -width*0.5);
	capsuleDesc[1].materialIndex = raycastWheelMaterialIndex;
	capsuleDesc[1].userData = &(wheelUserDatas[1]);
	actorDesc.shapes.pushBack(&capsuleDesc[1]);
	wheelUserDatas[1].frontWheel = true;

	capsuleDesc[2].radius = capsuleDesc[0].radius;
	capsuleDesc[2].height = capsuleDesc[0].height;
	capsuleDesc[2].flags = capsuleDesc[0].flags;
	capsuleDesc[2].localPose.M = capsuleDesc[0].localPose.M;
	capsuleDesc[2].localPose.t.set(-length*0.5, -height, -width*0.5);
	capsuleDesc[2].materialIndex = raycastWheelMaterialIndex;
	capsuleDesc[2].userData = &(wheelUserDatas[2]);
	actorDesc.shapes.pushBack(&capsuleDesc[2]);
	wheelUserDatas[2].frontWheel = false;

	capsuleDesc[3].radius = capsuleDesc[0].radius;
	capsuleDesc[3].height = capsuleDesc[0].height;
	capsuleDesc[3].flags = capsuleDesc[0].flags;
	capsuleDesc[3].localPose.M = capsuleDesc[0].localPose.M;
	capsuleDesc[3].localPose.t.set(-length*0.5, -height, width*0.5);
	capsuleDesc[3].materialIndex = raycastWheelMaterialIndex;
	capsuleDesc[3].userData = &(wheelUserDatas[3]);
	actorDesc.shapes.pushBack(&capsuleDesc[3]);
	wheelUserDatas[3].frontWheel = false;

	actorDesc.body			= &bodyDesc;
	actorDesc.globalPose.t  = pos;
	NxActor* a = gScene->createActor(actorDesc);

	//a->userData = &carData;		//so we can recoginze it in the contact stream

sPhysObject* pPhys = new sPhysObject;
pPhys->iID = 5;
a->userData = (void*)pPhys;

	//actorDesc.globalPose.t = NxVec3 ( fXPos, fYPos, fZPos );
NxMat33 mat;
mat.rotY ( D3DXToRadian ( 90 ) );
a->setGlobalOrientation ( mat );

	a->wakeUp(1e10);			//don't go to sleep.

	return a;
}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:93,代码来源:PhysXWrapper.cpp


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