本文整理汇总了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;
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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);
//.........这里部分代码省略.........