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


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

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


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

示例1:

//################################################################
//
// Body functions
//
pRigidBody*PhysicManager::getBody(const char*name,int flags/* =0 */)
{

	for (pWorldMapIt it  = getWorlds()->Begin(); it!=getWorlds()->End(); it++)
	{
		pWorld *w = *it;
		if(w)
		{
			int nbActors = w->getScene()->getNbActors();
			NxActor** actors = w->getScene()->getActors();
			while(nbActors--)
			{
				NxActor* actor = *actors++;
				if(actor->userData != NULL)
				{
					if (!strcmp(actor->getName(),name) )
					{

						pRigidBody* body =static_cast<pRigidBody*>(actor->userData);
						if (body)
						{
							return body;
						}
					}
				}
			}
		}
	}
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:34,代码来源:PhysicManagerBody.cpp

示例2: GravitateToGravitators

void GravitateToGravitators()
{
	NxU32 nbActors = gScene->getNbActors();
	NxActor** actors = gScene->getActors();
	NxReal m1,m2,G=gUniversalBigG,R;
	NxVec3 r,F;
	while (nbActors--)
	{
		NxActor* actor = *actors++;
		const char* name=actor->getName();
		if (strcmp(name,"~lander")==0)
		{
			F.zero();
			m1=actor->getMass();
			for (int k=0; k<gRavitators.size(); k++)
			{
				r = (gRavitators[k]->getCMassGlobalPosition() - actor->getCMassGlobalPosition());
				R = r.magnitudeSquared();
				m2= gRavitators[k]->getMass();
				F = r;
				F.setMagnitude(G*m1*m2/R);
				actor->addForce(F);
			}
		}
	}
}
开发者ID:nmovshov,项目名称:ARSS_win,代码行数:26,代码来源:pods.cpp

示例3: DrawLanders

void DrawLanders()
{
	// draw the landers in 2 colors
	NxU32 nbActors = gScene->getNbActors();
	NxActor** actors = gScene->getActors();
	while (nbActors--)
	{
		NxActor* actor = *actors++;
		const char *name=actor->getName();
		if (strcmp(name,"~lander")==0) {
			NxShape*const* shapes;
			shapes = actor->getShapes();
			NxU32 nShapes = actor->getNbShapes();
			//glDisable(GL_LIGHTING);
			char sname[256]="";
			while (nShapes--)
			{
				sprintf(sname,"%s",shapes[nShapes]->getName());
				if      (strcmp(sname,"upside")==0)
					glColor4f(0.0f,1.0f,0.0f,1.0f);
				else if (strcmp(sname,"downside")==0)
					glColor4f(1.0f,0.0f,0.0f,1.0f);
				else if (strcmp(sname,"U1")==0)
					glColor4f(1.0f,0.0f,0.0f,1.0f);
				else if (strcmp(sname,"U2")==0)
					glColor4f(0.0f,1.0f,0.0f,1.0f);
				else if (strcmp(sname,"U3")==0)
					glColor4f(0.0f,0.0f,1.0f,1.0f);
				DrawShape(shapes[nShapes], false);
			}
			//glEnable(GL_LIGHTING);
		}
	}
}
开发者ID:nmovshov,项目名称:ARSS_win,代码行数:34,代码来源:pods.cpp

示例4: onTrigger

void myTrigger::onTrigger(NxShape& triggerShape, NxShape& otherShape, NxTriggerFlag status){

	if ( ! triggerShape.getActor().userData && ! otherShape.getActor().userData )
	{
		return;
	}
	
	if (status & NX_TRIGGER_ON_ENTER)
	{
		// A body just entered the trigger area
		NxActor* triggerActor = &triggerShape.getActor();
		String name = triggerActor->getName();
		int thisTarget = StringConverter::parseInt(name);
		creditTarget(thisTarget);
	}
	
}
开发者ID:bytewrench,项目名称:NxOgre-Pinball,代码行数:17,代码来源:trigger.cpp

示例5: q

	SoftBone(const NXU::NxuBone &b,unsigned int acount,NxActor **alist,SoftBone *parent)
  {
  	mParent = parent;
		mActor = 0;

		for (unsigned int i=0; i<acount; i++)
		{
			NxActor *a = alist[i];
			const char *name = a->getName();
			if ( name )
			{
				if ( strcmp(name, b.mName) == 0 )
				{
					mActor = a;
					break;
				}
			}
		}

		NxQuat q( b.mOrientation );
		mLocalTransform.M.fromQuat(q);
		mLocalTransform.t.set( b.mPosition );

		if ( mActor )
		{
			mGlobalTransform = mActor->getGlobalPose();
		}
		else
		{
			if ( mParent )
			{
  			mGlobalTransform = parent->mGlobalTransform * mLocalTransform;
			}
  		else
			{
  			mGlobalTransform = mLocalTransform;
			}
		}

		mGlobalTransform.getInverse(mComposite);
  }
开发者ID:gbaumgart,项目名称:vt,代码行数:41,代码来源:SoftSkeleton.cpp

示例6: ReCreateExperiment

void ReCreateExperiment()
{
	gScene->simulate(0);
	gScene->checkResults(NX_ALL_FINISHED,true); // make sure time step is done
	
	// Re-set the crucial SDK parameters
	if (gPhysicsSDK)
	{
		gPhysicsSDK->setParameter(NX_VISUALIZE_ACTOR_AXES,0);
		gPhysicsSDK->setParameter(NX_VISUALIZE_WORLD_AXES,0);
		if (gBounceEps>0)
			gPhysicsSDK->setParameter(NX_BOUNCE_THRESHOLD,-gBounceEps);
		if (gSkinWidth>0)
			gPhysicsSDK->setParameter(NX_SKIN_WIDTH, gSkinWidth);
	}
	if (gScene)
	{
		if (bVarTimeStep)
			gScene->setTiming(gDeltaTime/4.0,4,NX_TIMESTEP_VARIABLE);
		else
			gScene->setTiming(gDeltaTime/4.0,4,NX_TIMESTEP_FIXED);
		gScene->setGravity(gDefaultGravity*bGravity);
	}

	// Next get to cleaning up the scene that was maybe loaded from file.
	if (gScene)
	{
		// Get rid of defined materials (who knows where they've been...)
		NxMaterial* mats[20]; // I hardly think we'll have more than 20
		NxU32 iter=0; // don't worry about it
		int nmats = gScene->getMaterialArray(mats,20,iter);
		while (nmats--)
		{
			gScene->releaseMaterial(*(mats[nmats]));
		}
		gCellMaterial=NULL;
		gLanderUpMaterial=NULL;
		gLanderDownMaterial=NULL;

		CreateExperimentMaterials(); // make shiny new materials

		// Now, look over all the actors, who knows where they've been. Find out then.
		NxU32 nbActors = gScene->getNbActors();
		NxActor** actors = gScene->getActors();
		while (nbActors--)
		{
			NxActor* actor = *actors++;
			const char *name=actor->getName();
			NxShape*const* shapes;
			shapes = actor->getShapes();
			NxU32 nShapes = actor->getNbShapes();

			// If it's a rubble grain, make sure it uses the default material
			if      (strcmp(name,"rubble")==0 || strcmp(name,"boulder")==0)
				while (nShapes--) shapes[nShapes]->setMaterial(0);

			// If it's a cell container, make sure it uses the cell material, and remember its pointer
			else if (strcmp(name,"left wall")==0) {
				shapes[0]->setMaterial(gCellMaterial->getMaterialIndex());
				gContainerCell[0]=actor;
			}
			else if (strcmp(name,"right wall")==0) {
				shapes[0]->setMaterial(gCellMaterial->getMaterialIndex());
				gContainerCell[1]=actor;
			}
			else if (strcmp(name,"in wall")==0) {
				shapes[0]->setMaterial(gCellMaterial->getMaterialIndex());
				gContainerCell[2]=actor;
			}
			else if (strcmp(name,"out wall")==0) {
				shapes[0]->setMaterial(gCellMaterial->getMaterialIndex());
				gContainerCell[3]=actor;
			}

			// If it's the ground plane it also uses default material
			else if (strcmp(name,"ground")==0) {
				shapes[0]->setMaterial(0);
				groundPlane=actor;
			}

			// If it's the lander, it has two shapes made of different material, but the lander will be recreated elsewhere...

			// Anything else, get rid of
			else
				gScene->releaseActor(*actor);
		
		}

		// If the container is damaged, recreate it
		for (int k=0; k<4; k++)
		{
			if (gContainerCell[k]==NULL) {
				for (int j=0; j<4; j++)
				{
					if (gContainerCell[j]) {
						gScene->releaseActor(*gContainerCell[j]);
						gContainerCell[j]=NULL;
					}
				}
				CreateContainerCell(gCellSize);
//.........这里部分代码省略.........
开发者ID:nmovshov,项目名称:ARSS_win,代码行数:101,代码来源:pods.cpp


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