本文整理汇总了C++中PlaneObject::killPlane方法的典型用法代码示例。如果您正苦于以下问题:C++ PlaneObject::killPlane方法的具体用法?C++ PlaneObject::killPlane怎么用?C++ PlaneObject::killPlane使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlaneObject
的用法示例。
在下文中一共展示了PlaneObject::killPlane方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool Ned3DObjectManager::interactPlaneTerrain(PlaneObject &plane, TerrainObject &terrain)
{
Terrain *terr = terrain.getTerrain();
if(terr == NULL) return false;
//test for plane collision with terrain
Vector3 planePos = plane.getPosition();
EulerAngles planeOrient = plane.getOrientation();
Vector3 disp = planePos - disp;
RotationMatrix planeMatrix;
planeMatrix.setup(plane.getOrientation()); // get plane's orientation
float planeBottom = plane.getBoundingBox().min.y;
float terrainHeight = terr->getHeight(planePos.x,planePos.z);
if(plane.isPlaneAlive() && planeBottom < terrainHeight)
{ //collision
Vector3 viewVector = planeMatrix.objectToInertial(Vector3(0,0,1));
if(viewVector * terr->getNormal(planePos.x,planePos.z) < -0.5f // dot product
|| plane.isCrashing())
{
plane.killPlane();
int partHndl = gParticle.createSystem("planeexplosion");
gParticle.setSystemPos(partHndl, plane.getPosition());
int boomHndl = gSoundManager.requestSoundHandle("Boom.wav");
int boomInst = gSoundManager.requestInstance(boomHndl);
if(boomInst != SoundManager::NOINSTANCE)
{
gSoundManager.setPosition(boomHndl,boomInst,plane.getPosition());
gSoundManager.play(boomHndl,boomInst);
gSoundManager.releaseInstance(boomHndl,boomInst);
}
plane.setSpeed(0.0f);
planePos += 2.0f * viewVector;
planeOrient.pitch = kPi / 4.0f;
planeOrient.bank = kPi / 4.0f;
plane.setOrientation(planeOrient);
}
else planePos.y = terrainHeight + planePos.y - planeBottom;
//plane.setPPosition(planePos);
return true;
}
return false;
}