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


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

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


在下文中一共展示了NxMat33::rotZ方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SetupBunnyScene

void World::SetupBunnyScene()
{
	NxSoftBodyDesc softBodyDesc;
	softBodyDesc.globalPose.t = NxVec3(0,35,-1);
	softBodyDesc.particleRadius = 0.2f;
	softBodyDesc.volumeStiffness = 1.0f;
	softBodyDesc.stretchingStiffness = 0.07f;
	softBodyDesc.friction = 1.0f;

	char *fileName = "bunny";	
	char tetFileName[256], objFileName[256], s[256];
	sprintf(tetFileName, "%s.tet", fileName);
	sprintf(objFileName, "%s.obj", fileName);

	ObjMesh *objMesh = new ObjMesh(); // it is for mesh surface rendering
	objMesh->loadFromObjFile(FindMediaFile(objFileName, s));  

	MySoftBody *softBody = new MySoftBody(gScene, softBodyDesc, FindMediaFile(tetFileName,s), objMesh);

	if (!softBody->getNxSoftBody())
	{
		printf("Error: Unable to create the SoftBody for the current scene.\n");
		delete softBody;
	} else
	{
		gSoftBodies.push_back(softBody);  // soft body is pushed to list.
		gObjMeshes.push_back(objMesh);  // surface mesh is pushed to list.
	}

	NxMat33 rot;
	NxActor *plate0 = CreateBox(NxVec3(-2.5,10,0), NxVec3(20.0f, 1.0f, 10.0f), 0,0.0f);
	rot.rotZ(1.5f);
	plate0->setGlobalOrientation(rot);
	NxActor *plate1 = CreateBox(NxVec3(2.5,10,0), NxVec3(20.0f, 1.0f, 10.0f), 0,0.0f);
	rot.rotZ(1.5f);
	plate1->setGlobalOrientation(rot);

	// set camera position and direction
	gCameraPos.set(-5.0f, 40.0f, 35.0f);
	gCameraForward.set(0.2,-1.1,-2);
	gCameraForward.normalize();
}
开发者ID:binly,项目名称:TestPhysx,代码行数:42,代码来源:MyCreateSoftBodies.cpp

示例3: posMat

pRigidBody*pFactory::createBody(CK3dEntity *referenceObject,CK3dEntity *worldReferenceObject,NXU::NxActorDesc *desc,int flags)
{

#ifdef _DEBUG
	assert(referenceObject);
	assert(desc);
#endif 
	
	/************************************************************************/
	/*                                                                      
	



	*/
	/************************************************************************/
	VxVector vpos;
	referenceObject->GetPosition(&vpos);

	VxQuaternion vquat;
	referenceObject->GetQuaternion(&vquat);

	NxQuat nrot  = desc->globalPose.M;
	NxVec3 npos = desc->globalPose.t;

	NxMat33 rotX;
	rotX.rotX( PI / 2.0f );
	NxMat33 rotZ;
	rotZ.rotZ( PI );

	NxMat34 rotMat;
	rotMat.M.multiply( rotZ, rotX );

	NxMat34 posMat( true );

/*	posMat.t.set(  -mTerrain->getPosition().x,
		mTerrain->getPosition().y,
		mTerrain->getPosition().z );
*/
	desc->globalPose.multiply( posMat, rotMat );


	NxQuat nrot2  = desc->globalPose.M;
	NxVec3 npos2 = desc->globalPose.t;

	VxQuaternion nvm  = getFromStream(nrot);

	VxVector nvpos = getFromStream(npos);

	

	for (NxU32 k=0; k<desc->mShapes.size(); k++)
	{
		NXU::NxShapeDesc *shape = desc->mShapes[k];
		NxVec3 locPos = shape->localPose.t;
		NxQuat localQuad = shape->localPose.M;
	}


	int op  = 2; 



	return NULL;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:65,代码来源:pFactoryBody.cpp


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