本文整理汇总了C++中IAnimatedMeshSceneNode::getJointCount方法的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMeshSceneNode::getJointCount方法的具体用法?C++ IAnimatedMeshSceneNode::getJointCount怎么用?C++ IAnimatedMeshSceneNode::getJointCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAnimatedMeshSceneNode
的用法示例。
在下文中一共展示了IAnimatedMeshSceneNode::getJointCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTank
void CRaycastTankExample::createTank(const stringw file, const stringw collFile, const vector3df &pos, const f32 mass)
{
IAnimatedMeshSceneNode *Node = device->getSceneManager()->addAnimatedMeshSceneNode(
device->getSceneManager()->getMesh(file.c_str()));
Node->setPosition(pos);
//Node->setRotation(vector3df(-40,90,0));
Node->setMaterialFlag(video::EMF_LIGHTING, true);
//Node->setScale(vector3df(2,2,4));
IGImpactMeshShape *shape = new IGImpactMeshShape(Node, device->getSceneManager()->getMesh(collFile.c_str()), mass);
tank = world->addRigidBody(shape);
// When using a raycast vehicle, we don't want this rigid body to deactivate.
tank->setActivationState(EAS_DISABLE_DEACTIVATION);
// Set some damping on the rigid body because the raycast vehicles tend to bounce a lot without a lot of tweaking.
// (cheap fix for the example only)
tank->setDamping(0.4, 0.4);
// We create our vehicle, passing our newly created rigid body as a parameter.
vehicle = world->addRaycastVehicle(tank);
// Set up our wheel construction info. These values can be changed for each wheel,
// and the values that you want to keep will stay the same, that way
// all parameters for each wheel can stay the same for what needs to remain equal,
// such as directions and suspension rest length.
SWheelInfoConstructionInfo wheel;
wheel.chassisConnectionPointCS = vector3df(0.0,-0.88,4.0);
wheel.wheelDirectionCS = vector3df(0.0,-0.1,0.0);
wheel.wheelAxleCS = vector3df(-0.5,0.0,0.0);
wheel.suspensionRestLength = 0.6;
wheel.wheelRadius = 8.0;
wheel.isFrontWheel = true;
// The bones are in the center of the mesh on the X axis, so we just set the width ourselves.
// Do the left row of wheels.
for(u32 i=0; i < Node->getJointCount(); i++)
{
// The bones that we need in this mesh are all named "RoadWheels" with a numerical suffix.
// So we do a quick check to make sure that no unwanted bones get through as wheels.
if(Node->getJointNode(i)->getName()[0] == 'R')
{
wheel.chassisConnectionPointCS = vector3df(-4, Node->getJointNode(i)->getPosition().Y,Node->getJointNode(i)->getPosition().Z);
vehicle->addWheel(wheel);
}
}
wheel.wheelAxleCS = vector3df(0.5,0.0,0.0);
// Do the right row of wheels.
for(u32 i=0; i < Node->getJointCount(); i++)
{
if(Node->getJointNode(i)->getName()[0] == 'R')
{
wheel.chassisConnectionPointCS = vector3df(4, Node->getJointNode(i)->getPosition().Y,Node->getJointNode(i)->getPosition().Z);
vehicle->addWheel(wheel);
}
}
for (u32 i=0;i<vehicle->getNumWheels();i++)
{
SWheelInfo &info = vehicle->getWheelInfo(i);
info.suspensionStiffness = 0.08f;
info.wheelDampingRelaxation = 20.0f;
info.wheelDampingCompression = 20.0f;
info.frictionSlip = 1000;
info.rollInfluence = 0.1f;
// We call updateWheel, which takes SWheelInfo as the first parameter,
// and the ID of the wheel to apply that info to. This must
// be called after any changes in order for the changes to actually take effect.
vehicle->updateWheelInfo(i);
}
}