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


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

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


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

示例1: if


//.........这里部分代码省略.........
	actor->setName(referenceObject->GetName());
	result->SetVT3DObject(referenceObject);
	actor->userData= result;


	//////////////////////////////////////////////////////////////////////////
	//Deformable : 
	if (isDeformable && cloth)
	{

		pDeformableSettings dSettings;
		dSettings.ImpulsThresold = 50.0f;
		dSettings.PenetrationDepth= 0.1f ;
		dSettings.MaxDeform = 2.0f;

		CKParameterOut *poutDS = referenceObject->GetAttributeParameter(GetPMan()->att_deformable);
		if (poutDS)
		{
			pFactory::Instance()->copyTo(dSettings,poutDS);
		}
		cloth->attachToCore(referenceObject,dSettings.ImpulsThresold,dSettings.PenetrationDepth,dSettings.MaxDeform);
		result->setCloth(cloth);
	}


	//////////////////////////////////////////////////////////////////////////
	//
	//	Extra settings : 
	//

	if (result->getFlags() & BF_Moving)
	{
		VxVector massOffsetOut;referenceObject->Transform(&massOffsetOut,&oDescr.massOffsetLinear);
		actor->setCMassOffsetGlobalPosition(pMath::getFrom(massOffsetOut));
	}

	if (result->getFlags() & BF_Kinematic)
	{
		result->setKinematic(true);
	}

	if (result->getFlags() & BF_Moving )
	{
		result->enableGravity(result->getFlags() & BF_Gravity);
	}

	if (result->getFlags() & BF_Sleep )
	{
		result->setSleeping(true);
	}

	if (oDescr.worlReference == 0)
	{
		if (GetPMan()->getDefaultWorld())
		{
			oDescr.worlReference = GetPMan()->getDefaultWorld()->getReference()->GetID();
		}
	}

	//----------------------------------------------------------------
	//
	// store mesh meta info in the first main mesh
	//
	NxShape *shape  = result->getShapeByIndex();
	if (shape)
	{
开发者ID:gbaumgart,项目名称:vt,代码行数:67,代码来源:pFactoryBody.cpp

示例2: createBody


//.........这里部分代码省略.........
			NxMaterialDesc  *entMat  = createMaterialFromEntity(referenceObject);
			material  = world->getScene()->createMaterial(entMatNull);
			material->loadFromDesc(*entMat);
			result->setMaterial(material);
		}else{
			if (world->getDefaultMaterial())
			{
				result->setMaterial(world->getDefaultMaterial());
			}
		}
		//////////////////////////////////////////////////////////////////////////

		NxBoxShapeDesc boxShape;
		if (creationFlags & E_OFC_DIMENSION )
		{
			boxShape.dimensions = pMath::getFrom(box_s)*0.5f;
		}
		boxShape.density  = descr->density;
		boxShape.materialIndex = result->getMaterial()->getMaterialIndex();
		if (result->getSkinWidth()!=-1.0f)
			boxShape.skinWidth = result->getSkinWidth();

		actorDesc.shapes.pushBack(&boxShape);

		//////////////////////////////////////////////////////////////////////////
		//dynamic object  ? 
		if (result->getFlags() & BF_Moving){
			actorDesc.body = &bodyDesc;
		}
		else
			actorDesc.body = NULL;

		//////////////////////////////////////////////////////////////////////////
		//set transformations
		actorDesc.density  = descr->density;

		if (creationFlags & E_OFC_POSITION)
		{
			actorDesc.globalPose.t = pos;	
		}

		if (creationFlags & E_OFC_POSITION)
		{
			actorDesc.globalPose.M = rot;
		}
		
				//////////////////////////////////////////////////////////////////////////
		//create the actor

		int v = actorDesc.isValid();
		NxActor *actor  = world->getScene()->createActor(actorDesc);
		if (!actor)
		{
			xLogger::xLog(ELOGERROR,E_LI_AGEIA,"Couldn't create actor");
			delete result;
			return NULL;

		}


		//////////////////////////////////////////////////////////////////////////
		//set additional settings : 
		result->setActor(actor);
		actor->setName(referenceObject->GetName());
		actor->userData= result;

		if (result->getFlags() & BF_Moving)
		{
			VxVector massOffsetOut;referenceObject->Transform(&massOffsetOut,&result->getMassOffset());
			actor->setCMassOffsetGlobalPosition(pMath::getFrom(massOffsetOut));
		}

		if (result->getFlags() & BF_Kinematic)
		{
			actor->raiseBodyFlag(NX_BF_KINEMATIC);
		}

		result->enableCollision((result->getFlags() & BF_Collision));
		if (result->getFlags() & BF_Moving)
		{
			if (!(result->getFlags() & BF_Gravity))
			{
				actor->raiseBodyFlag(NX_BF_DISABLE_GRAVITY);
			}
		}

		NxShape *shape  = result->getShapeByIndex();
		if (shape)
		{
			pSubMeshInfo *sInfo  = new pSubMeshInfo();
			sInfo->entID = referenceObject->GetID();
			sInfo->refObject  = (CKBeObject*)referenceObject;
			shape->userData = (void*)sInfo;
			result->setMainShape(shape);
			shape->setName(referenceObject->GetName());
		}
	}
		
	return result;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:101,代码来源:pFactoryBody.cpp


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