本文整理汇总了C++中NxActor::setGlobalOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ NxActor::setGlobalOrientation方法的具体用法?C++ NxActor::setGlobalOrientation怎么用?C++ NxActor::setGlobalOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxActor
的用法示例。
在下文中一共展示了NxActor::setGlobalOrientation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupAnimalScene
void World::SetupAnimalScene()
{
// Create the objects in the scene
NxSoftBodyDesc softBodyDesc;
softBodyDesc.globalPose.t = NxVec3(0.0f, 3.0f, 0.0f);
softBodyDesc.particleRadius = 0.2f;
softBodyDesc.volumeStiffness = 0.5f;
softBodyDesc.stretchingStiffness= 1.0f;
softBodyDesc.friction = 1.0f;
softBodyDesc.attachmentResponseCoefficient = 0.1f;
softBodyDesc.solverIterations = 5;
char *fileName = "froggyNormalized";
char tetFileName[256], objFileName[256], s[256];
sprintf(tetFileName, "%s.tet", fileName);
sprintf(objFileName, "%s.obj", fileName);
ObjMesh *objMesh = new ObjMesh();
objMesh->loadFromObjFile(FindMediaFile(objFileName, s));
gObjMeshes.pushBack(objMesh);
if(objMesh == NULL)
{
printf("objMesh %s\n");
}
NxMat33 rot;
rot.rotX(NxHalfPiF32);
for (int i = 0; i < 5; i++)
{
softBodyDesc.globalPose.t = NxVec3(0, 3+i*3, 0);
MySoftBody *softBody = new MySoftBody(gScene, softBodyDesc, FindMediaFile(tetFileName, s), objMesh);
assert(softBody);
if (!softBody->getNxSoftBody())
{
printf("Error: unable to create the softbody for the current scene.\n");
delete softBody;
}
else
{
gSoftBodies.pushBack(softBody);
NxActor *caps = MyCreateCapsule(NxVec3(0.0f, 3.0f + i*3.0f, -0.3f), 1.0f, 0.73f, 1.0f);
caps->userData = (void*)&gInvisible;
caps->setGlobalOrientation(rot);
softBody->getNxSoftBody()->attachToShape(caps->getShapes()[0], NX_SOFTBODY_ATTACHMENT_TWOWAY);
}
}
}
示例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;
}