本文整理汇总了C++中Point3F::isZero方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3F::isZero方法的具体用法?C++ Point3F::isZero怎么用?C++ Point3F::isZero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3F
的用法示例。
在下文中一共展示了Point3F::isZero方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: interpolateTick
void Projectile::interpolateTick(F32 delta)
{
Parent::interpolateTick(delta);
if( mHasExploded )
return;
Point3F interpPos = mCurrDeltaBase + mCurrBackDelta * delta;
Point3F dir = mCurrVelocity;
if(dir.isZero())
dir.set(0,0,1);
else
dir.normalize();
MatrixF xform(true);
xform = MathUtils::createOrientFromDir(dir);
xform.setPosition(interpPos);
setRenderTransform(xform);
// fade out the projectile image
S32 time = (S32)(mCurrTick - delta);
if(time > mDataBlock->fadeDelay)
{
F32 fade = F32(time - mDataBlock->fadeDelay);
mFadeValue = 1.0 - (fade / F32(mDataBlock->lifetime));
}
else
mFadeValue = 1.0;
updateSound();
}
示例2: outFlags
bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse )
{
physx::PxVec3 orig = px3Cast<physx::PxVec3>( startPnt );
physx::PxVec3 dir = px3Cast<physx::PxVec3>( endPnt - startPnt );
physx::PxF32 maxDist = dir.magnitude();
dir.normalize();
U32 groups = 0xffffffff;
groups &= ~( PX3_TRIGGER ); // No trigger shapes!
physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::eIMPACT | physx::PxHitFlag::eNORMAL);
physx::PxQueryFilterData filterData(physx::PxQueryFlag::eSTATIC|physx::PxQueryFlag::eDYNAMIC);
filterData.data.word0 = groups;
physx::PxRaycastBuffer buf;
if(!mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData))
return false;
if(!buf.hasBlock)
return false;
const physx::PxRaycastHit hit = buf.block;
physx::PxRigidActor *actor = hit.actor;
PhysicsUserData *userData = PhysicsUserData::cast( actor->userData );
if ( ri )
{
ri->object = ( userData != NULL ) ? userData->getObject() : NULL;
if ( ri->object == NULL )
ri->distance = hit.distance;
ri->normal = px3Cast<Point3F>( hit.normal );
ri->point = px3Cast<Point3F>( hit.position );
ri->t = maxDist / hit.distance;
}
if ( impulse.isZero() ||
!actor->isRigidDynamic() ||
actor->is<physx::PxRigidDynamic>()->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC )
return true;
physx::PxRigidBody *body = actor->is<physx::PxRigidBody>();
physx::PxVec3 force = px3Cast<physx::PxVec3>( impulse );
physx::PxRigidBodyExt::addForceAtPos(*body,force,hit.position,physx::PxForceMode::eIMPULSE);
return true;
}
示例3: emitParticles
void Projectile::emitParticles(const Point3F& from, const Point3F& to, const Point3F& vel, const U32 ms)
{
if ( mHasExploded )
return;
Point3F axis = -vel;
if( axis.isZero() )
axis.set( 0.0, 0.0, 1.0 );
else
axis.normalize();
bool fromWater = pointInWater(from);
bool toWater = pointInWater(to);
if (!fromWater && !toWater && bool(mParticleEmitter)) // not in water
mParticleEmitter->emitParticles(from, to, axis, vel, ms);
else if (fromWater && toWater && bool(mParticleWaterEmitter)) // in water
mParticleWaterEmitter->emitParticles(from, to, axis, vel, ms);
else if (!fromWater && toWater && mDataBlock->splash) // entering water
{
// cast the ray to get the surface point of the water
RayInfo rInfo;
if (gClientContainer.castRay(from, to, WaterObjectType, &rInfo))
{
MatrixF trans = getTransform();
trans.setPosition(rInfo.point);
Splash *splash = new Splash();
splash->onNewDataBlock(mDataBlock->splash, false);
splash->setTransform(trans);
splash->setInitialState(trans.getPosition(), Point3F(0.0, 0.0, 1.0));
if (!splash->registerObject())
{
delete splash;
splash = NULL;
}
// create an emitter for the particles out of water and the particles in water
if (mParticleEmitter)
mParticleEmitter->emitParticles(from, rInfo.point, axis, vel, ms);
if (mParticleWaterEmitter)
mParticleWaterEmitter->emitParticles(rInfo.point, to, axis, vel, ms);
}
}
else if (fromWater && !toWater && mDataBlock->splash) // leaving water
{
// cast the ray in the opposite direction since that point is out of the water, otherwise
// we hit water immediately and wont get the appropriate surface point
RayInfo rInfo;
if (gClientContainer.castRay(to, from, WaterObjectType, &rInfo))
{
MatrixF trans = getTransform();
trans.setPosition(rInfo.point);
Splash *splash = new Splash();
splash->onNewDataBlock(mDataBlock->splash,false);
splash->setTransform(trans);
splash->setInitialState(trans.getPosition(), Point3F(0.0, 0.0, 1.0));
if (!splash->registerObject())
{
delete splash;
splash = NULL;
}
// create an emitter for the particles out of water and the particles in water
if (mParticleEmitter)
mParticleEmitter->emitParticles(rInfo.point, to, axis, vel, ms);
if (mParticleWaterEmitter)
mParticleWaterEmitter->emitParticles(from, rInfo.point, axis, vel, ms);
}
}
}