本文整理汇总了C++中NxActor::getGlobalOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ NxActor::getGlobalOrientation方法的具体用法?C++ NxActor::getGlobalOrientation怎么用?C++ NxActor::getGlobalOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxActor
的用法示例。
在下文中一共展示了NxActor::getGlobalOrientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildModelRobot
void Simulation::buildModelRobot(int indexRobot, int indexScene, int indexTeam)
{
//Veiculo descricao
//Body Descricao
NxActor* robotActor = Simulation::getActorRobot(indexScene, indexRobot);
//NxBounds3 bodyBounds;
//robotShapes[0]->getWorldBounds(bodyBounds);
NxVehicleDesc vehicleDesc;
vehicleDesc.position = NxVec3(robotActor->getGlobalPosition());
float mass = 5.;
vehicleDesc.mass = mass;//robotActor->getMass(); //PLUGIN TAH COM PROBLEMA XML ERRADO
//vehicleDesc.motorForce = 70000;
//vehicleDesc.maxVelocity = 300.f;
//vehicleDesc.cameraDistance = 8.0f;
vehicleDesc.centerOfMass.set(NxVec3(0,0,0));//robotActor->getCMassLocalPosition());
//vehicleDesc.differentialRatio = 3.42f;
//vehicleDesc.transmissionEfficiency
vehicleDesc.actor = robotActor;
vehicleDesc.actor->setMaxAngularVelocity(6.2);
vehicleDesc.actor->setMass(mass);
//TODO: LEVANTAR DAMPING
float t = vehicleDesc.actor->getLinearDamping();
float b = vehicleDesc.actor->getAngularDamping();
//vehicleDesc.actor->setAngularDamping(0.5);
//vehicleDesc.actor->setLinearDamping(0.5);
//TODO: LEVANTAR CMASS E INERTIA TENSOR
//vehicleDesc.actor->setCMassOffsetGlobalPosition(NxVec3(0, 0, 0));
NxMat33 inertiaTensor = NxMat33(NxVec3(1294.4362, 3.14502, -66.954), NxVec3(3.14502, 1094.42351, -0.24279), NxVec3(-66.954, -0.24279, 1754.80511));
vehicleDesc.actor->setCMassOffsetLocalPose( NxMat34( inertiaTensor, NxVec3(0,0,0) ) );
//TODO: Diagonalizar inertiaTensor e passar para setMassSpaceInertiaTensor
vehicleDesc.actor->setMassSpaceInertiaTensor(/*vehicleDesc.actor->getMassSpaceInertiaTensor()*1000.*/NxVec3(1764.3, 1284.9, 1094.4) );
//Motor descricao
//NxVehicleMotorDesc motorsDesc[4];
//for(NxU32 i=0;i<4;i++)
//{
//motorsDesc[i].setToCorvette();
//vehicleDesc.motorsDesc.push_back(&motorsDesc[i]);
//}
//Roda (Wheel) descricao
int numberWheels = Simulation::getNumberWheels(indexScene, indexRobot);
NxWheelDesc* wheelDesc = new NxWheelDesc[numberWheels];
for(NxU32 i=0; i<numberWheels; i++)
{
//NxActor* wheelModel = Simulation::getActorWheel(indexScene,indexRobot,i);
//NxActorDesc wheelActorDesc;
//wheelModel->saveToDesc(wheelActorDesc);
//Simulation::gScenes[0]->releaseActor(*wheelModel);
NxActor* actorWheel = Simulation::getActorWheel(indexScene,indexRobot,i);//wheelModel;//Simulation::gScenes[0]->createActor(wheelActorDesc);
//NxShape*const* wheelShapes = actorWheel->getShapes();
//NxBounds3 wheelBounds;
//wheelShapes[0]->getWorldBounds(wheelBounds);
//Para exportar modelo da roda do 3ds Max
// NxWhee
//wheelDesc[i]
//robot1Shapes[0]->isConvexMesh()->getConvexMesh().saveToDesc(convexMesh);
//NxWheelShape* wheelShape = (NxWheelShape*)wheel;
//NxTriangleMeshDesc meshDesc = *((NxTriangleMeshDesc*)(mesh->userData));
//robot1Shapes[0]->isWheel()->
//wheelDesc[i].wheelApproximation = 10;
wheelDesc[i].wheelOrientation = actorWheel->getGlobalOrientation();
wheelDesc[i].position.set(actorWheel->getGlobalPosition()-robotActor->getGlobalPosition());
//wheelDesc[i].position.z = 0;
wheelDesc[i].id = i;
wheelDesc[i].wheelRadius = 27.6;
//wheelDesc[i].wheelWidth = 100;
wheelDesc[i].wheelSuspension = 0;
wheelDesc[i].springRestitution = 0;
wheelDesc[i].springDamping = 0;
wheelDesc[i].springBias = 0.0f;
wheelDesc[i].maxBrakeForce = 100;
wheelDesc[i].frictionToFront = 0.1f;//0.1f; //TODO: CONFIGURAR PARÂMETRO
wheelDesc[i].frictionToSide = 0;//0.02f; //TODO: CONFIGURAR PARÂMETRO
wheelDesc[i].inverseWheelMass = 0.1; //TODO: CONFIGURAR PARÂMETRO
//Angulo das Rodas (Omni)
NxVec3 wheelPosRel = actorWheel->getGlobalPosition() - robotActor->getGlobalPosition();
wheelDesc[i].angWheelRelRobot = NxMath::atan2( wheelPosRel.y, wheelPosRel.x );
vehicleDesc.robotWheels.pushBack(&wheelDesc[i]);
Simulation::gScenes[indexScene]->scene->releaseActor(*actorWheel);
//NxU32 flags = NX_WF_BUILD_LOWER_HALF;
wheelDesc[i].wheelFlags = NX_WF_ACCELERATED | NX_WF_AFFECTED_BY_HANDBRAKE | NX_WF_USE_WHEELSHAPE | NX_WF_BUILD_LOWER_HALF;// |/*NX_WF_STEERABLE_INPUT |*/ flags;
}
//NxBall* teste = Simulation::gScenes[indexScene]->ball;
//Criar robot, vehicle base
NxRobot* robot = (NxRobot*)NxRobot::createVehicle(Simulation::gScenes[indexScene], &vehicleDesc);
if(robot) {
robot->setId(indexRobot);
//.........这里部分代码省略.........