本文整理汇总了C++中setMaskBits函数的典型用法代码示例。如果您正苦于以下问题:C++ setMaskBits函数的具体用法?C++ setMaskBits怎么用?C++ setMaskBits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMaskBits函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: extend
void Turret::updateMove (PlayerMove *move, float interval)
{
if (data->isSustained == false) {
if (getControlClient() && state != EXTENDED)
{
if (!isGhost())
extend (interval);
}
if (state != EXTENDED)
move = NULL;
float oTR = turretRotation;
float oTE = turretElevation;
if (move && (!animThread || animThread->getPriority() != -1 ||
animThread->getPosition() >= 1.0))
{
#if 0
float maxSpeed = data->speed * data->speedModifier * interval;
float moveFrac = interval * 32;
#else
float maxSpeed = data->speed * data->speedModifier;
float moveFrac = interval * 16;
#endif
float pitch = m_clamp(move->pitch,-maxSpeed,maxSpeed);
float turn = m_clamp(move->turnRot,-maxSpeed,maxSpeed);
turretElevation += pitch * moveFrac;
turretRotation += turn * moveFrac;
wrapElevation ();
if (maxElevation != minElevation)
{
if (turretElevation > maxElevation)
turretElevation = maxElevation;
if (turretElevation < minElevation)
turretElevation = minElevation;
}
wrapRotation ();
if (maxRotation != minRotation)
{
if (turretRotation > maxRotation)
turretRotation = maxRotation;
if (turretRotation < minRotation)
turretRotation = minRotation;
}
if (move->trigger)
{
if (!isGhost ())
shoot (true);
}
if (move->jumpAction && !isGhost())
{
const char *fn = scriptName("jump");
if(fn)
Console->executef(2, fn, scriptThis());
}
}
if (elevationThread && maxElevation != minElevation)
elevationThread->SetPosition ((turretElevation - minElevation) / (maxElevation - minElevation));
if (rotationThread)
{
if (!isEqual (maxRotation, minRotation))
rotationThread->SetPosition ((turretRotation - minRotation) / (maxRotation - minRotation));
else
rotationThread->SetPosition (turretRotation / M_2PI);
}
// this is for the firing anim...
if (animThread && state == EXTENDED)
animThread->AdvanceTime (interval);
// this is for the power anim...
if (animThread && isGhost())
{
if (state == EXTENDING)
extend (interval);
else
if (state == RETRACTING)
retract (interval);
}
if (!isGhost ())
{
// Need to animate on the server to get the
// node transforms.
image.shape->animate ();
if (oTE != turretElevation)
setMaskBits (ElevationMask);
if (oTR != turretRotation)
setMaskBits (TRotationMask);
}
//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:turret.cpp
示例2: _conformLights
void Sun::inspectPostApply()
{
_conformLights();
setMaskBits(UpdateMask);
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:5,代码来源:sun.cpp
示例3: setMaskBits
void AITurretShape::setTurretState(U32 newState, bool force)
{
setMaskBits(TurretStateMask);
// If going back into the same state, just reset the timer
// and invoke the script callback
if (!force && mState == &mDataBlock->state[newState])
{
mStateDelayTime = mState->timeoutValue;
if (mState->script && !isGhost())
_scriptCallback(mState->script);
return;
}
mState = &mDataBlock->state[newState];
// Reset cyclic sequences back to the first frame to turn it off
// (the first key frame should be it's off state).
if (mStateAnimThread && mStateAnimThread->getSequence()->isCyclic())
{
mShapeInstance->setPos(mStateAnimThread,0);
mShapeInstance->setTimeScale(mStateAnimThread,0);
}
AITurretShapeData::StateData& stateData = *mState;
// Check for immediate transitions
S32 ns;
if ((ns = stateData.transition.rest[mAtRest]) != -1)
{
setTurretState(ns);
return;
}
if ((ns = stateData.transition.target[mTarget.isValid()]) != -1)
{
setTurretState(ns);
return;
}
if ((ns = stateData.transition.activated[mStateActive]) != -1)
{
setTurretState(ns);
return;
}
//
// Initialize the new state...
//
mStateDelayTime = stateData.timeoutValue;
// Play animation
if (mStateAnimThread && stateData.sequence != -1)
{
mShapeInstance->setSequence(mStateAnimThread,stateData.sequence, stateData.direction ? 0.0f : 1.0f);
F32 timeScale = (stateData.scaleAnimation && stateData.timeoutValue) ?
mShapeInstance->getDuration(mStateAnimThread) / stateData.timeoutValue : 1.0f;
mShapeInstance->setTimeScale(mStateAnimThread, stateData.direction ? timeScale : -timeScale);
}
// Script callback on server
if (stateData.script && stateData.script[0] && !isGhost())
_scriptCallback(stateData.script);
// If there is a zero timeout, and a timeout transition, then
// go ahead and transition imediately.
if (!mStateDelayTime)
{
if ((ns = stateData.transition.timeout) != -1)
{
setTurretState(ns);
return;
}
}
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:74,代码来源:aiTurretShape.cpp
示例4: setMaskBits
void BasicClouds::inspectPostApply()
{
Parent::inspectPostApply();
setMaskBits( BasicCloudsMask );
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:5,代码来源:basicClouds.cpp
示例5: _generateEdges
void DecalRoad::regenerate()
{
_generateEdges();
_captureVerts();
setMaskBits( NodeMask | GenEdgesMask | ReClipMask );
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:6,代码来源:decalRoad.cpp
示例6: setMaskBits
void PathCamera::setState(State s)
{
mState = s;
setMaskBits(StateMask);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:5,代码来源:pathCamera.cpp
示例7: setMaskBits
void CoverPoint::setTransform(const MatrixF & mat)
{
Parent::setTransform(mat);
setMaskBits(TransformMask);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:5,代码来源:coverPoint.cpp
示例8: getAngulerPosition
void Turret::trackAndFire (Player *closePlayer, float interval)
{
if (data->isSustained == false) {
Vector3F rot = getAngulerPosition();
int aimed = 0;
float old_rot = turretRotation;
float increment = data->speed * interval;
float des_z;
Point3F playerPos;
float dist = m_distf (getBoxCenter(), closePlayer->getLeadCenter());
leadPosition (closePlayer->getLeadCenter(), closePlayer->getLeadVelocity(), dist, &playerPos);
TMat3F invMat;
getNodeOffset (&invMat, "dummy muzzle", gunNode);
invMat.inverse();
m_mul (Point3F (playerPos.x, playerPos.y, playerPos.z), invMat, &playerPos);
des_z = rotation (-playerPos.x, -playerPos.y);
while (des_z < 0)
des_z += (float)M_2PI;
while (des_z > M_2PI)
des_z -= (float)M_2PI;
float diff = des_z - turretRotation;
if (diff > M_PI || diff < -M_PI)
increment = -increment;
if (diff < increment && diff > -increment)
{
turretRotation = des_z;
aimed += 1;
}
else
if (diff < 0)
turretRotation -= increment;
else
turretRotation += increment;
wrapRotation ();
if (turretRotation != old_rot)
setMaskBits (TRotationMask);
float old_elevation = turretElevation;
float des_y;
increment = data->speed * interval;
des_y = elevation (playerPos.x, playerPos.y, playerPos.z);
diff = des_y - turretElevation;
if (diff > M_PI || diff < -M_PI)
increment = -increment;
if (diff < increment && diff > -increment)
{
turretElevation = des_y;
aimed += 1;
}
else
if (diff < 0)
turretElevation -= increment;
else
turretElevation += increment;
wrapElevation ();
if (old_elevation != turretElevation)
setMaskBits (ElevationMask);
if (closePlayer && aimed >= 2 && waitTime <= manager->getCurrentTime())
shoot (false, closePlayer);
} else {
Vector3F rot = getAngulerPosition();
int aimed = 0;
float old_rot = turretRotation;
float increment = data->speed * interval;
float des_z;
Point3F playerPos;
float dist = m_distf (getBoxCenter(), closePlayer->getLeadCenter());
leadPosition (closePlayer->getLeadCenter(), closePlayer->getLeadVelocity(), dist, &playerPos);
TMat3F invMat;
getNodeOffset (&invMat, "dummy muzzle", gunNode);
invMat.inverse();
m_mul (Point3F (playerPos.x, playerPos.y, playerPos.z), invMat, &playerPos);
des_z = rotation (-playerPos.x, -playerPos.y);
while (des_z < 0)
des_z += (float)M_2PI;
while (des_z > M_2PI)
des_z -= (float)M_2PI;
float diff = des_z - turretRotation;
//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:turret.cpp
示例9: setMaskBits
void Turret::retract (float interval)
{
if (!isGhost() && state != RETRACTED && state != RETRACTING)
setMaskBits (StateMask);
if (!animThread || !setPowerThread ())
state = RETRACTED;
else
{
if (state == EXTENDED)
animThread->SetPosition (1.0);
state = RETRACTING;
if (turretRotation == 0)
{
if (!isGhost())
setMaskBits (TRotationMask);
if (animThread->getPosition () == 1.0 && data && data->deactivateSound != -1)
{
if(isGhost())
TSFX::PlayAt(data->deactivateSound, getTransform(), Point3F(0, 0, 0));
if (whirSound)
{
Sfx::Manager::Stop (manager, whirSound);
whirSound = 0;
}
}
animThread->AdvanceTime (-interval);
if (animThread->getPosition () <= 0.0)
{
// setFireThread ();
state = RETRACTED;
if (!isGhost())
setMaskBits (StateMask);
}
}
else
{
if (isGhost())
{
if (whirSound)
{
Sfx::Manager *man = Sfx::Manager::find (manager);
man->selectHandle(whirSound);
if (man->isDone ())
whirSound = TSFX::PlayAt(data->whirSound, getTransform(), Point3F(0, 0, 0));
// man->play ();
}
else
if (data && data->whirSound != -1)
whirSound = TSFX::PlayAt(data->whirSound, getTransform(), Point3F(0, 0, 0));
}
else
setMaskBits (TRotationMask);
float tr = turretRotation;
while (tr > M_PI)
tr -= M_2PI;
if (tr > 0)
{
turretRotation -= data->speed * interval;
tr -= data->speed * interval;
if (tr < 0)
turretRotation = 0;
}
else
{
turretRotation += data->speed * interval;
tr += data->speed * interval;
if (tr > 0)
turretRotation = 0;
}
}
}
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:81,代码来源:turret.cpp
示例10: scriptThis
//.........这里部分代码省略.........
if (data->maxGunEnergy)
{
float e;
e = energy > data->maxGunEnergy ? data->maxGunEnergy : energy;
float pofm = e / float(data->maxGunEnergy);
bullet->setEnergy (e, pofm);
energy -= e;
setEnergy (energy);
}
SimGroup *grp = NULL;
if(SimObject *obj = manager->findObject("MissionCleanup"))
grp = dynamic_cast<SimGroup*>(obj);
if(!manager->registerObject(bullet))
delete bullet;
else
{
if(grp)
grp->addObject(bullet);
else
manager->addObject(bullet);
}
waitTime = manager->getCurrentTime() + data->reloadDelay;
if (animThread)
{
setFireThread ();
animThread->SetPosition (0.0);
}
fireCount++;
setMaskBits (ShootingMask);
}
}
} else {
if (data && data->projectile.type == -1) {
if (!isGhost())
if (const char* script = scriptName("onFire"))
Console->executef(2, script, scriptThis());
}
else {
float energy = getEnergy();
if (waitTime <= manager->getCurrentTime() && data && energy >= data->minGunEnergy && data->projectile.type != -1) {
TMat3F muzzleTransform;
getMuzzleTransform(0, &muzzleTransform);
Projectile* bullet = createProjectile(data->projectile);
if (!playerControlled && data->deflection) {
static Random random;
EulerF angles;
muzzleTransform.angles (&angles);
angles.x += (random.getFloat() - 0.5) * M_2PI * data->deflection;
angles.z += (random.getFloat() - 0.5) * M_2PI * data->deflection;
muzzleTransform.set (angles, muzzleTransform.p);
} else if (playerControlled) {
Point3F start = muzzleTransform.p;
muzzleTransform = getEyeTransform ();
aimedTransform (&muzzleTransform, start);
muzzleTransform.p = start;
}
bullet->initProjectile (muzzleTransform, Point3F (0, 0, 0), getId());
AssertFatal(bullet->isSustained() == true, "Error, must be sustained bullet");
SimGroup *grp = NULL;
if(SimObject *obj = manager->findObject("MissionCleanup"))
grp = dynamic_cast<SimGroup*>(obj);
if(!manager->registerObject(bullet))
delete bullet;
else
{
if(grp)
grp->addObject(bullet);
else
manager->addObject(bullet);
}
if (animThread) {
setFireThread ();
animThread->SetPosition (0.0);
}
fireCount++;
setMaskBits (ShootingMask);
m_fireState = Firing;
m_beganState = wg->currentTime;
m_pProjectile = bullet;
m_pTarget = targetPlayer;
if (m_pTarget)
deleteNotify(m_pTarget);
}
}
}
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:turret.cpp
示例11: AssertFatal
void
Turret::serverProcessFiring(DWORD in_currTime)
{
if (!getControlClient() && getState () == StaticBase::Enabled && isActive()) {
AssertFatal(m_pProjectile != NULL, "Must have projectile");
if (m_pTarget == NULL) {
// Lost our target, or player mount just ended...
unshoot();
return;
}
if (in_currTime >= m_beganState + data->firingTime) {
// If the firing time runs out, we switch to reloading...
unshoot();
return;
}
float useRange = data->gunRange == -1 ? data->iRange : data->gunRange;
float minDist = useRange;
if (isTargetable(m_pTarget, &minDist, useRange) == false) {
unshoot();
return;
}
// Guess we're still good, track the player...
float interval = 0.032;
Vector3F rot = getAngulerPosition();
int aimed = 0;
float old_rot = turretRotation;
float increment = data->speed * interval;
float des_z;
Point3F playerPos;
float dist = m_distf (getBoxCenter(), m_pTarget->getLeadCenter());
leadPosition (m_pTarget->getLeadCenter(), m_pTarget->getLeadVelocity(), dist, &playerPos);
TMat3F invMat;
getNodeOffset (&invMat, "dummy muzzle", gunNode);
invMat.inverse();
m_mul (Point3F (playerPos.x, playerPos.y, playerPos.z), invMat, &playerPos);
des_z = rotation (-playerPos.x, -playerPos.y);
while (des_z < 0)
des_z += (float)M_2PI;
while (des_z > M_2PI)
des_z -= (float)M_2PI;
float diff = des_z - turretRotation;
if (diff > M_PI || diff < -M_PI)
increment = -increment;
if (diff < increment && diff > -increment)
{
turretRotation = des_z;
aimed += 1;
}
else
if (diff < 0)
turretRotation -= increment;
else
turretRotation += increment;
wrapRotation ();
if (turretRotation != old_rot)
setMaskBits (TRotationMask);
float old_elevation = turretElevation;
float des_y;
increment = data->speed * interval;
des_y = elevation (playerPos.x, playerPos.y, playerPos.z);
diff = des_y - turretElevation;
if (diff > M_PI || diff < -M_PI)
increment = -increment;
if (diff < increment && diff > -increment)
{
turretElevation = des_y;
aimed += 1;
}
else
if (diff < 0)
turretElevation -= increment;
else
turretElevation += increment;
wrapElevation ();
if (old_elevation != turretElevation)
setMaskBits (ElevationMask);
}
if (m_pProjectile)
m_pProjectile->updateImageTransform(getEyeTransform());
//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:turret.cpp
示例12: deleteObject
void Projectile::simulate( F32 dt )
{
if ( isServerObject() && mCurrTick >= mDataBlock->lifetime )
{
deleteObject();
return;
}
if ( mHasExploded )
return;
// ... otherwise, we have to do some simulation work.
RayInfo rInfo;
Point3F oldPosition;
Point3F newPosition;
oldPosition = mCurrPosition;
if ( mDataBlock->isBallistic )
mCurrVelocity.z -= 9.81 * mDataBlock->gravityMod * dt;
newPosition = oldPosition + mCurrVelocity * dt;
// disable the source objects collision reponse for a short time while we
// determine if the projectile is capable of moving from the old position
// to the new position, otherwise we'll hit ourself
bool disableSourceObjCollision = (mSourceObject.isValid() && mCurrTick <= SourceIdTimeoutTicks);
if ( disableSourceObjCollision )
mSourceObject->disableCollision();
disableCollision();
// Determine if the projectile is going to hit any object between the previous
// position and the new position. This code is executed both on the server
// and on the client (for prediction purposes). It is possible that the server
// will have registered a collision while the client prediction has not. If this
// happens the client will be corrected in the next packet update.
// Raycast the abstract PhysicsWorld if a PhysicsPlugin exists.
bool hit = false;
if ( mPhysicsWorld )
hit = mPhysicsWorld->castRay( oldPosition, newPosition, &rInfo, Point3F( newPosition - oldPosition) * mDataBlock->impactForce );
else
hit = getContainer()->castRay(oldPosition, newPosition, csmDynamicCollisionMask | csmStaticCollisionMask, &rInfo);
if ( hit )
{
// make sure the client knows to bounce
if ( isServerObject() && ( rInfo.object->getTypeMask() & csmStaticCollisionMask ) == 0 )
setMaskBits( BounceMask );
MatrixF xform( true );
xform.setColumn( 3, rInfo.point );
setTransform( xform );
mCurrPosition = rInfo.point;
// Get the object type before the onCollision call, in case
// the object is destroyed.
U32 objectType = rInfo.object->getTypeMask();
// re-enable the collision response on the source object since
// we need to process the onCollision and explode calls
if ( disableSourceObjCollision )
mSourceObject->enableCollision();
// Ok, here is how this works:
// onCollision is called to notify the server scripts that a collision has occurred, then
// a call to explode is made to start the explosion process. The call to explode is made
// twice, once on the server and once on the client.
// The server process is responsible for two things:
// 1) setting the ExplosionMask network bit to guarantee that the client calls explode
// 2) initiate the explosion process on the server scripts
// The client process is responsible for only one thing:
// 1) drawing the appropriate explosion
// It is possible that during the processTick the server may have decided that a hit
// has occurred while the client prediction has decided that a hit has not occurred.
// In this particular scenario the client will have failed to call onCollision and
// explode during the processTick. However, the explode function will be called
// during the next packet update, due to the ExplosionMask network bit being set.
// onCollision will remain uncalled on the client however, therefore no client
// specific code should be placed inside the function!
onCollision( rInfo.point, rInfo.normal, rInfo.object );
// Next order of business: do we explode on this hit?
if ( mCurrTick > mDataBlock->armingDelay || mDataBlock->armingDelay == 0 )
{
mCurrVelocity = Point3F::Zero;
explode( rInfo.point, rInfo.normal, objectType );
}
if ( mDataBlock->isBallistic )
{
// Otherwise, this represents a bounce. First, reflect our velocity
// around the normal...
Point3F bounceVel = mCurrVelocity - rInfo.normal * (mDot( mCurrVelocity, rInfo.normal ) * 2.0);
mCurrVelocity = bounceVel;
// Add in surface friction...
Point3F tangent = bounceVel - rInfo.normal * mDot(bounceVel, rInfo.normal);
mCurrVelocity -= tangent * mDataBlock->bounceFriction;
//.........这里部分代码省略.........
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:101,代码来源:projectile.cpp
示例13: setMaskBits
void Projectile::explode( const Point3F &p, const Point3F &n, const U32 collideType )
{
// Make sure we don't explode twice...
if ( mHasExploded )
return;
mHasExploded = true;
// Move the explosion point slightly off the surface to avoid problems with radius damage
Point3F explodePos = p + n * 0.001f;
if ( isServerObject() )
{
// Do what the server needs to do, damage the surrounding objects, etc.
mExplosionPosition = explodePos;
mExplosionNormal = n;
mCollideHitType = collideType;
mDataBlock->onExplode_callback( this, mExplosionPosition, mFadeValue );
setMaskBits(ExplosionMask);
// Just wait till the timeout to self delete. This
// gives server object time to get ghosted to the client.
}
else
{
// Client just plays the explosion at the right place...
//
Explosion* pExplosion = NULL;
if (mDataBlock->waterExplosion && pointInWater(p))
{
pExplosion = new Explosion;
pExplosion->onNewDataBlock(mDataBlock->waterExplosion, false);
}
else
if (mDataBlock->explosion)
{
pExplosion = new Explosion;
pExplosion->onNewDataBlock(mDataBlock->explosion, false);
}
if( pExplosion )
{
MatrixF xform(true);
xform.setPosition(explodePos);
pExplosion->setTransform(xform);
pExplosion->setInitialState(explodePos, n);
pExplosion->setCollideType( collideType );
if (pExplosion->registerObject() == false)
{
Con::errorf(ConsoleLogEntry::General, "Projectile(%s)::explode: couldn't register explosion",
mDataBlock->getName() );
delete pExplosion;
pExplosion = NULL;
}
}
// Client (impact) decal.
if ( mDataBlock->decal )
gDecalManager->addDecal(p, n, mRandF(0.0f, M_2PI_F), mDataBlock->decal);
// Client object
updateSound();
}
/*
// Client and Server both should apply forces to PhysicsWorld objects
// within the explosion.
if ( false && mPhysicsWorld )
{
F32 force = 200.0f;
mPhysicsWorld->explosion( p, 15.0f, force );
}
*/
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:77,代码来源:projectile.cpp
示例14: qDebug
void ReplicatedObject::setValue(QString value)
{
qDebug() << "Value Set";
_value = value;
setMaskBits(Value);
}
开发者ID:brendan0powers,项目名称:Random-Projects,代码行数:6,代码来源:replicatedobject.cpp
示例15: setMaskBits
void DecalRoad::inspectPostApply()
{
Parent::inspectPostApply();
setMaskBits( DecalRoadMask );
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:6,代码来源:decalRoad.cpp
示例16: dSprintf
void Projectile::explode(const Point3F& p, const Point3F& n, const U32 collideType)
{
// Make sure we don't explode twice...
if (mHidden == true)
return;
mHidden = true;
if (isServerObject()) {
// Do what the server needs to do, damage the surrounding objects, etc.
mExplosionPosition = p;
mExplosionNormal = n;
mCollideHitType = collideType;
char buffer[128];
dSprintf(buffer, sizeof(buffer), "%g %g %g", mExplosionPosition.x,
mExplosionPosition.y,
mExplosionPosition.z);
Con::executef(mDataBlock, "onExplode", scriptThis(), buffer, Con::getFloatArg(mFadeValue));
setMaskBits(ExplosionMask);
safeDeleteObject();
}
else
{
// Client just plays the explosion at the right place...
//
Explosion* pExplosion = NULL;
if (mDataBlock->waterExplosion && pointInWater(p))
{
pExplosion = new Explosion;
pExplosion->onNewDataBlock(mDataBlock->waterExplosion);
}
else
if (mDataBlock->explosion)
{
pExplosion = new Explosion;
pExplosion->onNewDataBlock(mDataBlock->explosion);
}
if( pExplosion )
{
MatrixF xform(true);
xform.setPosition(p);
pExplosion->setTransform(xform);
pExplosion->setInitialState(p, n);
pExplosion->setCollideType( collideType );
if (pExplosion->registerObject() == false)
{
Con::errorf(ConsoleLogEntry::General, "Projectile(%s)::explode: couldn't register explosion",
mDataBlock->getName() );
delete pExplosion;
pExplosion = NULL;
}
}
// Client (impact) decal.
if ( mDataBlock->decal )
gDecalManager->addDecal( p, n, 0.0f, mDataBlock->decal );
// Client object
updateSound();
}
/*
// Client and Server both should apply forces to PhysicsWorld objects
// within the explosion.
if ( false && mPhysicsWorld )
{
F32 force = 200.0f;
mPhysicsWorld->explosion( p, 15.0f, force );
}
*/
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:74,代码来源:projectile.cpp
示例17: _setRotation
void AITurretShape::recenterTurret()
{
mRot.set(0,0,0);
_setRotation( mRot );
setMaskBits(TurretUpdateMask);
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:6,代码来源:aiTurretShape.cpp
示例18: setMaskBits
void ForestWindEmitter::inspectPostApply()
{
// Force the client update!
setMaskBits(0xffffffff);
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:5,代码来源:forestWindEmitter.cpp
示例19: getAimTransform
//.........这里部分代码省略.........
{
// We can't track any more
_cleanupTargetAndTurret();
return;
}
targetPos = sightPoint;
// Store latest target info
mTarget.lastPos = targetPos;
mTarget.lastVel = mTarget.target->getVelocity();
mTarget.lastSightTime = Sim::getCurrentTime();
}
// Calculate angles to face the target, specifically the part that we can see
VectorF toTarget;
MatrixF mat;
S32 node = mDataBlock->aimNode;
if (node != -1)
{
// Get the current position of our node
MatrixF* nodeTrans = &mShapeInstance->mNodeTransforms[node];
Point3F currentPos;
nodeTrans->getColumn(3, ¤tPos);
// Turn this into a matrix we can use to put the target
// position into our space.
MatrixF nodeMat(true);
nodeMat.setColumn(3, currentPos);
mat.mul(mObjToWorld, nodeMat);
mat.affineInverse();
}
else
{
mat = mWorldToObj;
}
mat.mulP(targetPos, &toTarget);
// lead the target
F32 timeToTargetSquared = (mWeaponLeadVelocitySquared > 0) ? toTarget.lenSquared() / mWeaponLeadVelocitySquared : 0;
if (timeToTargetSquared > 1.0)
{
targetPos = targetPos + (mTarget.lastVel * mSqrt(timeToTargetSquared));
mat.mulP(targetPos, &toTarget);
}
F32 yaw, pitch;
MathUtils::getAnglesFromVector(toTarget, yaw, pitch);
if (yaw > M_PI_F)
yaw = yaw - M_2PI_F;
//if (pitch > M_PI_F)
// pitch = -(pitch - M_2PI_F);
Point3F rot(pitch, 0.0f, -yaw);
// If we have a rotation rate make sure we follow it
if (mHeadingRate > 0)
{
F32 rate = mHeadingRate * dt;
F32 rateCheck = mFabs(rot.z - mRot.z);
if (rateCheck > rate)
{
// This will clamp the new value to the rate regardless if it
// is increasing or decreasing.
rot.z = mClampF(rot.z, mRot.z-rate, mRot.z+rate);
}
}
if (mPitchRate > 0)
{
F32 rate = mPitchRate * dt;
F32 rateCheck = mFabs(rot.x - mRot.x);
if (rateCheck > rate)
{
// This will clamp the new value to the rate regardless if it
// is increasing or decreasing.
rot.x = mClampF(rot.x, mRot.x-rate, mRot.x+rate);
}
}
// Test if the rotation to the target is outside of our limits
if (_outsideLimits(rot))
{
// We can't track any more
_cleanupTargetAndTurret();
return;
}
// Test if the target is out of weapons range
if (toTarget.lenSquared() > mWeaponRangeSquared)
{
// We can't track any more
_cleanupTargetAndTurret();
return;
}
mRot = rot;
_setRotation( mRot );
setMaskBits(TurretUpdateMask);
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:101,代码来源:aiTurretShape.cpp
示例20: setMaskBits
void WaterObject::inspectPostApply()
{
Parent::inspectPostApply();
setMaskBits( UpdateMask | WaveMask | TextureMask | SoundMask );
}
开发者ID:fr1tz,项目名称:alux3d,代码行数:6,代码来源:waterObject.cpp
注:本文中的setMaskBits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论