这篇教程C++ GetVectors函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetVectors函数的典型用法代码示例。如果您正苦于以下问题:C++ GetVectors函数的具体用法?C++ GetVectors怎么用?C++ GetVectors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetVectors函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: EyePosition//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------void CNPC_GroundTurret::Shoot(){ FireBulletsInfo_t info; Vector vecSrc = EyePosition(); Vector vecDir; GetVectors( &vecDir, NULL, NULL ); for( int i = 0 ; i < 1 ; i++ ) { info.m_vecSrc = vecSrc; if( i > 0 || !GetEnemy()->IsPlayer() ) { // Subsequent shots or shots at non-players random GetVectors( &info.m_vecDirShooting, NULL, NULL ); info.m_vecSpread = m_vecSpread; } else { // First shot is at the enemy. info.m_vecDirShooting = GetActualShootTrajectory( vecSrc ); info.m_vecSpread = VECTOR_CONE_PRECALCULATED; } info.m_iTracerFreq = 1; info.m_iShots = 1; info.m_pAttacker = this; info.m_flDistance = MAX_COORD_RANGE; info.m_iAmmoType = m_iAmmoType; FireBullets( info ); } // Do the AR2 muzzle flash CEffectData data; data.m_nEntIndex = entindex(); data.m_nAttachmentIndex = LookupAttachment( "eyes" ); data.m_flScale = 1.0f; data.m_fFlags = MUZZLEFLASH_COMBINE; DispatchEffect( "MuzzleFlash", data ); EmitSound( "NPC_FloorTurret.ShotSounds", m_ShotSounds ); if( IsX360() ) { m_flTimeNextShoot = gpGlobals->curtime + 0.2; } else { m_flTimeNextShoot = gpGlobals->curtime + 0.09; }}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:56,
示例2: CreateEntityByName//-----------------------------------------------------------------------------// Purpose: //-----------------------------------------------------------------------------void CAntlionGrub::CreateNugget( void ){ CGrubNugget *pNugget = (CGrubNugget *) CreateEntityByName( "item_grubnugget" ); if ( pNugget == NULL ) return; Vector vecOrigin; Vector vecForward; GetAttachment( LookupAttachment( "glow" ), vecOrigin, &vecForward ); // Find out what size to make this nugget! int nDenomination = GetNuggetDenomination(); pNugget->SetDenomination( nDenomination ); pNugget->SetAbsOrigin( vecOrigin ); pNugget->SetAbsAngles( RandomAngle( 0, 360 ) ); DispatchSpawn( pNugget ); IPhysicsObject *pPhys = pNugget->VPhysicsGetObject(); if ( pPhys ) { Vector vecForward; GetVectors( &vecForward, NULL, NULL ); Vector vecVelocity = RandomVector( -35.0f, 35.0f ) + ( vecForward * -RandomFloat( 50.0f, 75.0f ) ); AngularImpulse vecAngImpulse = RandomAngularImpulse( -100.0f, 100.0f ); pPhys->AddVelocity( &vecVelocity, &vecAngImpulse ); }}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:33,
示例3: switchvoid CNPC_GMan::RunTask( const Task_t *pTask ){ switch( pTask->iTask ) { case TASK_WAIT: // look at who I'm talking to if (m_flTalkTime > gpGlobals->curtime && m_hTalkTarget != NULL) { AddLookTarget( m_hTalkTarget->GetAbsOrigin(), 1.0, 2.0 ); } // look at player, but only if playing a "safe" idle animation else if (m_hPlayer != NULL && (GetSequence() == 0 || IsInC5A1()) ) { AddLookTarget( m_hPlayer->EyePosition(), 1.0, 3.0 ); } else { // Just center the head forward. Vector forward; GetVectors( &forward, NULL, NULL ); AddLookTarget( GetAbsOrigin() + forward * 12.0f, 1.0, 1.0 ); SetBoneController( 0, 0 ); } BaseClass::RunTask( pTask ); break; } SetBoneController( 0, 0 ); BaseClass::RunTask( pTask );}
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:31,
示例4: GetAbsAngles//------------------------------------------------------------------------------Vector C_BeamSpotLight::SpotlightCurrentPos(void){ QAngle angles = GetAbsAngles(); GetVectors( &m_vSpotlightDir, NULL, NULL ); Vector position = GetAbsOrigin(); int cacheIndex = -1; if ( m_pCache ) { cacheIndex = int( angles[m_nRotationAxis] * float(NUM_CACHE_ENTRIES) * (1.0f / 360.0f)) & (NUM_CACHE_ENTRIES - 1); if ( m_pCache[cacheIndex].IsValidFor(GetAbsOrigin()) ) { return position + m_vSpotlightDir * m_pCache[cacheIndex].m_radius; } } // Get beam end point. Only collide with solid objects, not npcs trace_t tr; UTIL_TraceLine( position, position + (m_vSpotlightDir * 2 * m_flSpotlightMaxLength), MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr ); if ( cacheIndex >= 0 ) { m_pCache[cacheIndex].Cache(position, tr); } return tr.endpos;}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:27,
示例5: GetVectorsbool C_EnvProjectedTexture::IsWithinFarZ(float flLightFOV){ //No need to check camera space lights for visibility, as they should always be close enough to the player. if (m_bCameraSpace) return true; //Trace forward to the nearest opaque brush face Vector vForward; GetVectors(&vForward, NULL, NULL); Vector vTraceStart = GetAbsOrigin(); Vector vTraceEnd = GetAbsOrigin() + vForward; trace_t tr; CTraceFilterWorldOnly filter; UTIL_TraceLine(vTraceStart, vTraceEnd, CONTENTS_SOLID && CONTENTS_OPAQUE, &filter, &tr); //Test to see if the player is close enough to the light to actually see the light's projection. This is based entirely on it's FarZ. C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer(); if (pPlayer) { Vector vDistance; VectorSubtract(tr.endpos, pPlayer->EyePosition(), vDistance); float fDistance = vDistance.LengthSqr(); //If distance is greater than the light's FarZ, cease to render. //FarZ determines how far away a light can be seen by the player, AND how far the light travels from it's source in stock Valve code. if (fDistance > Square(m_flFarZ + flLightFOV * 10)) return false; } return true;}
开发者ID:KyleGospo,项目名称:City-17-Episode-One-Source-2013,代码行数:34,
示例6: GetRocketShootPosition//-----------------------------------------------------------------------------// Purpose: //-----------------------------------------------------------------------------void CPropAPC::FireRocket( void ){ if ( m_flRocketTime > gpGlobals->curtime ) return; // If we're still firing the salvo, fire quickly m_iRocketSalvoLeft--; if ( m_iRocketSalvoLeft > 0 ) { m_flRocketTime = gpGlobals->curtime + ROCKET_DELAY_TIME; } else { // Reload the salvo m_iRocketSalvoLeft = ROCKET_SALVO_SIZE; m_flRocketTime = gpGlobals->curtime + random->RandomFloat( ROCKET_MIN_BURST_PAUSE_TIME, ROCKET_MAX_BURST_PAUSE_TIME ); } Vector vecRocketOrigin; GetRocketShootPosition( &vecRocketOrigin ); static float s_pSide[] = { 0.966, 0.866, 0.5, -0.5, -0.866, -0.966 }; Vector forward; GetVectors( &forward, NULL, NULL ); Vector vecDir; CrossProduct( Vector( 0, 0, 1 ), forward, vecDir ); vecDir.z = 1.0f; vecDir.x *= s_pSide[m_nRocketSide]; vecDir.y *= s_pSide[m_nRocketSide]; if ( ++m_nRocketSide >= 6 ) { m_nRocketSide = 0; } VectorNormalize( vecDir ); Vector vecVelocity; VectorMultiply( vecDir, ROCKET_SPEED, vecVelocity ); QAngle angles; VectorAngles( vecDir, angles ); CAPCMissile *pRocket = (CAPCMissile *)CAPCMissile::Create( vecRocketOrigin, angles, vecVelocity, this ); pRocket->IgniteDelay(); if ( m_hSpecificRocketTarget ) { pRocket->AimAtSpecificTarget( m_hSpecificRocketTarget ); m_hSpecificRocketTarget = NULL; } else if ( m_strMissileHint != NULL_STRING ) { pRocket->SetGuidanceHint( STRING( m_strMissileHint ) ); } EmitSound( "PropAPC.FireRocket" ); m_OnFiredMissile.FireOutput( this, this );}
开发者ID:paralin,项目名称:hl2sdk,代码行数:63,
示例7: _L1TXXvoid _L1TXX( short xpos, short ypos, char _WCI86FAR * str,/*========*/ struct xycoord _WCI86FAR * concat, struct xycoord _WCI86FAR * extent )/* Inquire the extents of the character drawing parallelogram and return the concatenation point. The concatenation point is the same as the drawing point if it cannot be calculated exactly. */{ short hor; /* horizontal alignment */ short vert; /* vertical alignment */ struct xycoord up; /* character up vector */ struct xycoord base; /* character base line vector */ struct xycoord space; /* spacing between characters */ struct xycoord length; /* horizontal side of parallelogram */ struct xycoord height; /* vertical side of parallelogram */ struct xycoord trans; /* translation for parallelogram */ GetVectors( &base, &up ); GetAlignment( &hor, &vert ); CalcSpacing( &base, &up, &space ); CalcSides( &length, &height, &base, &up, &space, str ); CalcTranslation( &trans, &length, &height, &up, hor, vert ); CalcCorners( extent, &length, &height, &trans, xpos, ypos ); if( _TextSettings.txpath == _PATH_RIGHT || _TextSettings.txpath == _PATH_LEFT ) { CalcConcat( concat, &length, &space, xpos, ypos, hor, vert ); } else { CalcConcat( concat, &height, &space, xpos, ypos, hor, vert ); }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:30,
示例8: WorldAlignMinsvoid CNPC_Ichthyosaur::DragVictim( float moveDist ){ Vector mins, maxs; float width; mins = WorldAlignMins(); maxs = WorldAlignMaxs(); width = ( maxs.y - mins.y ) * 0.5f; Vector forward, up; GetVectors( &forward, NULL, &up ); Vector newPos = GetAbsOrigin() + ( (forward+(up*0.25f)) * ( moveDist + width + DRAG_OFFSET ) ); trace_t tr; AI_TraceEntity( this, m_pVictim->GetAbsOrigin(), newPos, MASK_NPCSOLID, &tr ); if ( ( tr.fraction == 1.0f ) && ( tr.m_pEnt != this ) ) { UTIL_SetOrigin( m_pVictim, tr.endpos ); } else { ReleaseVictim(); }}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:26,
示例9: GetVectorsvoid CASW_Rocket::Explode( void ){ // Don't explode against the skybox. Just pretend that // the missile flies off into the distance. Vector forward; GetVectors( &forward, NULL, NULL ); trace_t tr; UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + forward * 16, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); m_takedamage = DAMAGE_NO; SetSolid( SOLID_NONE ); if( tr.fraction == 1.0 || !(tr.surface.flags & SURF_SKY) ) { bool bHitCreature = tr.m_pEnt && tr.m_pEnt->IsNPC(); DoExplosion(!bHitCreature); } //UTIL_Remove( this ); SetTouch( NULL ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_NONE ); SetNextThink( gpGlobals->curtime + 0.2f ); SetThink( &CASW_Rocket::SUB_Remove );}
开发者ID:docfinorlias,项目名称:asb2,代码行数:27,
示例10: VectorNormalizevoid CNPC_Zombine::ReleaseGrenade( Vector vPhysgunPos ){ if ( HasGrenade() == false ) return; Vector vDir = vPhysgunPos - m_hGrenade->GetAbsOrigin(); VectorNormalize( vDir ); Activity aActivity; Vector vForward, vRight; GetVectors( &vForward, &vRight, NULL ); float flDotForward = DotProduct( vForward, vDir ); float flDotRight = DotProduct( vRight, vDir ); bool bNegativeForward = false; bool bNegativeRight = false; if ( flDotForward < 0.0f ) { bNegativeForward = true; flDotForward = flDotForward * -1; } if ( flDotRight < 0.0f ) { bNegativeRight = true; flDotRight = flDotRight * -1; } if ( flDotRight > flDotForward ) { if ( bNegativeRight == true ) aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_WEST; else aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_EAST; } else { if ( bNegativeForward == true ) aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_BACK; else aActivity = (Activity)ACT_ZOMBINE_GRENADE_FLINCH_FRONT; } AddGesture( aActivity ); DropGrenade( vec3_origin ); if ( IsSprinting() ) { StopSprint(); } else { Sprint(); }}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:59,
示例11: GetVectorsvoid CNPC_CombineDropship::DoRotorWash( void ){ Vector vecForward; GetVectors( &vecForward, NULL, NULL ); Vector vecRotorHub = GetAbsOrigin() + vecForward * -64; DrawRotorWash( DROPSHIP_WASH_ALTITUDE, vecRotorHub );}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:9,
示例12: SetNextThink//---------------------------------------------------------// A different bounce behavior for the citizen-modified mine. Detonates at the top of its apex, // and does not attempt to track enemies.//---------------------------------------------------------void CBounceBomb::CavernBounceThink(){ SetNextThink( gpGlobals->curtime + 0.1 ); StudioFrameAdvance(); IPhysicsObject *pPhysicsObject = VPhysicsGetObject(); if ( pPhysicsObject != NULL ) { const float MINE_MAX_JUMP_HEIGHT = 78; // Figure out how much headroom the mine has, and hop to within a few inches of that. trace_t tr; UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, MINE_MAX_JUMP_HEIGHT ), MASK_SHOT, this, COLLISION_GROUP_INTERACTIVE, &tr ); float height; if( tr.m_pEnt && tr.m_pEnt->VPhysicsGetObject() ) { // Physics object resting on me. Jump as hard as allowed to try to knock it away. height = MINE_MAX_JUMP_HEIGHT; } else { height = tr.endpos.z - GetAbsOrigin().z; height -= BOUNCEBOMB_RADIUS; if ( height < 0.1 ) height = 0.1; } float time = sqrt( height / (0.5 * sv_gravity.GetFloat()) ); float velocity = sv_gravity.GetFloat() * time; // or you can just AddVelocity to the object instead of ApplyForce float force = velocity * pPhysicsObject->GetMass(); Vector up; GetVectors( NULL, NULL, &up ); pPhysicsObject->Wake(); pPhysicsObject->ApplyForceCenter( up * force ); if( m_hNearestNPC ) { Vector vecPredict = m_hNearestNPC->GetSmoothedVelocity(); pPhysicsObject->ApplyForceCenter( vecPredict * (pPhysicsObject->GetMass() * 0.65f) ); } pPhysicsObject->ApplyTorqueCenter( AngularImpulse( random->RandomFloat( 15, 40 ), random->RandomFloat( 15, 40 ), random->RandomFloat( 30, 60 ) ) ); EmitSound( "NPC_CombineMine.Hop" ); SetThink( &CBounceBomb::ExplodeThink ); SetNextThink( gpGlobals->curtime + 0.33f ); }}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:61,
示例13: GetAttachment//-----------------------------------------------------------------------------// Purpose: Create danger sounds in front of the vehicle.//-----------------------------------------------------------------------------void CASW_PropJeep::CreateDangerSounds( void ){ QAngle dummy; GetAttachment( "Muzzle", m_vecGunOrigin, dummy ); if ( m_flDangerSoundTime > gpGlobals->curtime ) return; QAngle vehicleAngles = GetLocalAngles(); Vector vecStart = GetAbsOrigin(); Vector vecDir, vecRight; GetVectors( &vecDir, &vecRight, NULL ); const float soundDuration = 0.25; float speed = m_VehiclePhysics.GetHLSpeed(); // Make danger sounds ahead of the jeep if ( fabs(speed) > 120 ) { Vector vecSpot; float steering = m_VehiclePhysics.GetSteering(); if ( steering != 0 ) { if ( speed > 0 ) { vecDir += vecRight * steering * 0.5; } else { vecDir -= vecRight * steering * 0.5; } VectorNormalize(vecDir); } const float radius = speed * 0.4; // 0.3 seconds ahead of the jeep vecSpot = vecStart + vecDir * (speed * 0.3f); CSoundEnt::InsertSound( SOUND_DANGER, vecSpot, radius, soundDuration, this, 0 ); CSoundEnt::InsertSound( SOUND_PHYSICS_DANGER, vecSpot, radius, soundDuration, this, 1 ); //NDebugOverlay::Box(vecSpot, Vector(-radius,-radius,-radius),Vector(radius,radius,radius), 255, 0, 255, 0, soundDuration);#if 0 trace_t tr; // put sounds a bit to left and right but slightly closer to Jeep to make a "cone" of sound // in front of it vecSpot = vecStart + vecDir * (speed * 0.5f) - vecRight * speed * 0.5; UTIL_TraceLine( vecStart, vecSpot, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); CSoundEnt::InsertSound( SOUND_DANGER, vecSpot, 400, soundDuration, this, 1 ); vecSpot = vecStart + vecDir * (speed * 0.5f) + vecRight * speed * 0.5; UTIL_TraceLine( vecStart, vecSpot, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); CSoundEnt::InsertSound( SOUND_DANGER, vecSpot, 400, soundDuration, this, 2);#endif } m_flDangerSoundTime = gpGlobals->curtime + 0.1;}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:60,
示例14: Precachevoid CNPC_Hydra::Spawn(){ Precache(); BaseClass::Spawn(); SetModel( "models/Hydra.mdl" ); SetHullType(HULL_HUMAN); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetBloodColor( BLOOD_COLOR_RED ); ClearEffects(); m_iHealth = 20; m_flFieldOfView = -1.0;// indicates the width of this NPC's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; GetVectors( NULL, NULL, &m_vecOutward ); SetAbsAngles( QAngle( 0, 0, 0 ) ); m_vecChain.Set( 0, GetAbsOrigin( ) - m_vecOutward * 32 ); m_vecChain.Set( 1, GetAbsOrigin( ) + m_vecOutward * 16 ); m_vecHeadGoal = m_vecChain[1] + m_vecOutward * HYDRA_OUTWARD_BIAS; m_vecHeadDir = Vector( 0, 0, 1 ); // init bones HydraBone bone; bone.flActualLength = 0.0f; bone.vecGoalPos = Vector(0.0f, 0.0f, 0.0f); bone.vecPos = GetAbsOrigin( ) - m_vecOutward * HYDRA_INWARD_BIAS; m_body.AddToTail( bone ); bone.vecPos = m_vecChain[1]; m_body.AddToTail( bone ); bone.vecPos = m_vecHeadGoal; m_body.AddToTail( bone ); bone.vecPos = m_vecHeadGoal + m_vecHeadDir; m_body.AddToTail( bone ); m_idealSegmentLength = sv_hydraSegmentLength.GetFloat(); for (int i = 2; i < CHAIN_LINKS; i++) { m_vecChain.Set( i, m_vecChain[i-1] ); } m_seed = random->RandomFloat( 0.0, 2000.0 ); NPCInit(); m_takedamage = DAMAGE_NO;}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:56,
示例15: GetOwner//-----------------------------------------------------------------------------// Purpose: Try to encourage Alyx not to use her weapon at point blank range,// but don't prevent her from defending herself if cornered.// Input : flDot - // flDist - // Output : int//-----------------------------------------------------------------------------int CWeaponAlyxGun::WeaponRangeAttack1Condition( float flDot, float flDist ){#ifdef HL2_EPISODIC if( flDist < m_fMinRange1 ) { // If Alyx is not able to fire because an enemy is too close, start a timer. // If the condition persists, allow her to ignore it and defend herself. The idea // is to stop Alyx being content to fire point blank at enemies if she's able to move // away, without making her defenseless if she's not able to move. float flTime; if( m_flTooCloseTimer == TOOCLOSETIMER_OFF ) { m_flTooCloseTimer = gpGlobals->curtime; } flTime = gpGlobals->curtime - m_flTooCloseTimer; if( flTime > ALYX_TOOCLOSETIMER ) { // Fake the range to allow Alyx to shoot. flDist = m_fMinRange1 + 1.0f; } } else { m_flTooCloseTimer = TOOCLOSETIMER_OFF; } int nBaseCondition = BaseClass::WeaponRangeAttack1Condition( flDot, flDist ); // While in a vehicle, we extend our aiming cone (this relies on COND_NOT_FACING_ATTACK // TODO: This needs to be rolled in at the animation level if ( GetOwner()->IsInAVehicle() ) { Vector vecRoughDirection = ( GetOwner()->GetEnemy()->WorldSpaceCenter() - WorldSpaceCenter() ); Vector vecRight; GetVectors( NULL, &vecRight, NULL ); bool bRightSide = ( DotProduct( vecRoughDirection, vecRight ) > 0.0f ); float flTargetDot = ( bRightSide ) ? -0.7f : 0.0f; if ( nBaseCondition == COND_NOT_FACING_ATTACK && flDot >= flTargetDot ) { nBaseCondition = COND_CAN_RANGE_ATTACK1; } } return nBaseCondition;#else return BaseClass::WeaponRangeAttack1Condition( flDot, flDist );#endif//HL2_EPISODIC}
开发者ID:Muini,项目名称:Nag-asw,代码行数:63,
示例16: GetVectorsinline bool CNPC_Portal_FloorTurret::OnSide( void ){ if ( GetWaterLevel() > 0 ) return true; Vector up; GetVectors( NULL, NULL, &up ); return ( DotProduct( up, Vector(0,0,1) ) < 0.5f );}
开发者ID:RubberWar,项目名称:Portal-2,代码行数:10,
示例17: GetVectors//-----------------------------------------------------------------------------// Purpose: Get shoot position of BCC at an arbitrary position// Input :// Output ://-----------------------------------------------------------------------------Vector CRebelZombie::Weapon_ShootPosition( ){ Vector right; GetVectors( NULL, &right, NULL ); // FIXME: rename this "estimated" since it's not based on animation // FIXME: the orientation won't be correct when testing from arbitary positions for arbitary angles return GetAbsOrigin() + REBEL_ZOMBIE_GUN_STANDING_POSITION + right * 8;}
开发者ID:KyleGospo,项目名称:City-17-Episode-One-Source,代码行数:15,
示例18: Assert//---------------------------------------------------------//---------------------------------------------------------void CBounceBomb::UpdateLight( bool bTurnOn, unsigned int r, unsigned int g, unsigned int b, unsigned int a ){ if( bTurnOn ) { Assert( a > 0 ); // Throw the old sprite away if( m_hSprite ) { UTIL_Remove( m_hSprite ); m_hSprite.Set( NULL ); } if( !m_hSprite.Get() ) { Vector up; GetVectors( NULL, NULL, &up ); // Light isn't on. m_hSprite = CSprite::SpriteCreate( "sprites/glow01.vmt", GetAbsOrigin() + up * 10.0f, false ); CSprite *pSprite = (CSprite *)m_hSprite.Get(); if( m_hSprite ) { pSprite->SetParent( this ); pSprite->SetTransparency( kRenderTransAdd, r, g, b, a, kRenderFxNone ); pSprite->SetScale( 0.35, 0.0 ); } } else { // Update color CSprite *pSprite = (CSprite *)m_hSprite.Get(); pSprite->SetTransparency( kRenderTransAdd, r, g, b, a, kRenderFxNone ); } } if( !bTurnOn ) { if( m_hSprite ) { UTIL_Remove( m_hSprite ); m_hSprite.Set( NULL ); } } if ( !m_hSprite ) { m_LastSpriteColor.SetRawColor( 0 ); } else { m_LastSpriteColor.SetColor( r, g, b, a ); }}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:57,
示例19: Precache//-----------------------------------------------------------------------------// Spawn!//-----------------------------------------------------------------------------void CEnvHeadcrabCanister::Spawn( void ){ Precache(); BaseClass::Spawn(); // Do we have a position to launch from? if ( m_iszLaunchPositionName != NULL_STRING ) { // It doesn't have any real presence at first. SetSolid( SOLID_NONE ); m_vecImpactPosition = GetAbsOrigin(); m_bIncomingSoundStarted = false; m_bLanded = false; m_bHasDetonated = false; m_bOpened = false; } else if ( !HasSpawnFlags( SF_START_IMPACTED ) ) { // It doesn't have any real presence at first. SetSolid( SOLID_NONE ); if ( !HasSpawnFlags( SF_LAND_AT_INITIAL_POSITION ) ) { Vector vecForward; GetVectors( &vecForward, NULL, NULL ); vecForward *= -1.0f; trace_t trace; UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + vecForward * 10000, MASK_NPCWORLDSTATIC, this, COLLISION_GROUP_NONE, &trace ); m_vecImpactPosition = trace.endpos; } else { m_vecImpactPosition = GetAbsOrigin(); } m_bIncomingSoundStarted = false; m_bLanded = false; m_bHasDetonated = false; m_bOpened = false; } else { m_bHasDetonated = true; m_bIncomingSoundStarted = true; m_bOpened = false; m_vecImpactPosition = GetAbsOrigin(); Landed(); }}
开发者ID:NEITMod,项目名称:HL2BM2,代码行数:56,
示例20: VectorSubtract//-----------------------------------------------------------------------------// Is the vgui screen backfacing?//-----------------------------------------------------------------------------bool C_VGuiScreen::IsBackfacing( const Vector &viewOrigin ){ // Compute a ray from camera to center of the screen.. Vector cameraToScreen; VectorSubtract( GetAbsOrigin(), viewOrigin, cameraToScreen ); // Figure out the face normal Vector zaxis; GetVectors( NULL, NULL, &zaxis ); // The actual backface cull return (DotProduct( zaxis, cameraToScreen ) > 0.0f);}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:16,
示例21: GetVectors//-----------------------------------------------------------------------------// Purpose: // Input : velocity - //-----------------------------------------------------------------------------void CNPC_Ichthyosaur::AddSwimNoise( Vector *velocity ){ Vector right, up; GetVectors( NULL, &right, &up ); float lNoise, vNoise; lNoise = LATERAL_NOISE_MAX * sin( gpGlobals->curtime * LATERAL_NOISE_FREQ ); vNoise = VERTICAL_NOISE_MAX * sin( gpGlobals->curtime * VERTICAL_NOISE_FREQ ); (*velocity) += ( right * lNoise ) + ( up * vNoise );}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:17,
示例22: GetVectors//-----------------------------------------------------------------------------// Purpose: //-----------------------------------------------------------------------------void CAntlionGrub::SpawnSquashedGrub( void ){ // If we're already invisible, we're done if ( GetEffects() & EF_NODRAW ) return; Vector vecUp; GetVectors( NULL, NULL, &vecUp ); CBaseEntity *pGib = CreateRagGib( ANTLIONGRUB_SQUASHED_MODEL, GetAbsOrigin(), GetAbsAngles(), vecUp * 16.0f ); if ( pGib ) { pGib->AddEffects( EF_NOSHADOW ); }}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:17,
示例23: GetVectors//------------------------------------------------------------------------------// Purpose :// Input :// Output ://------------------------------------------------------------------------------void CAI_Hint::Spawn( void ){ // Cache off the forward vector GetVectors( &m_vecForward, NULL, NULL ); if( m_nodeFOV != 360 ) { // As a micro-optimization, leave the FOV at 360 to save us // a dot product later when checking node FOV. m_nodeFOV = cos( DEG2RAD(m_nodeFOV/2) ); } SetSolid( SOLID_NONE );}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:19,
示例24: StopPowerjumpvoid C_CFPlayer::PostThink(){ if ( IsAlive() && (GetFlags() & FL_ONGROUND) && m_bPowerjump ) StopPowerjump(); BaseClass::PostThink(); Instructor_Think(); for (int i = 1; i < gpGlobals->maxClients; i++) { C_BasePlayer *pPlayer = UTIL_PlayerByIndex( i ); if (!pPlayer) continue; C_CFPlayer* pCFPlayer = ToCFPlayer(pPlayer); if (CFGameRules()->PlayerRelationship(this, pCFPlayer) == GR_TEAMMATE) continue; // Far enemies are not important. if ((EyePosition() - pCFPlayer->WorldSpaceCenter()).Length() > 500) continue; trace_t result; CTraceFilterNoNPCsOrPlayer traceFilter( NULL, COLLISION_GROUP_NONE ); UTIL_TraceLine( EyePosition(), pCFPlayer->WorldSpaceCenter(), MASK_VISIBLE_AND_NPCS, &traceFilter, &result ); if (result.fraction != 1.0f) //if (!pPlayer->IsVisible(pCFTarget)) // This is unfortunately a server-only function, though I'd love to use it here. continue; m_flLastEnemySeen = gpGlobals->curtime; break; } if (!IsInFollowMode() || !ShouldLockFollowModeView()) { Vector vecForward; GetVectors(&vecForward, NULL, NULL); if (m_flLastCameraTargetTime == 0) { if (!GetRecursedTarget()) m_hLastCameraTarget = NULL; m_vecLastCameraTarget = m_vecLastTargetPosition = EyePosition() + vecForward*100; } }}
开发者ID:BSVino,项目名称:Arcon,代码行数:49,
示例25: ComputeActualTargetPosition//-----------------------------------------------------------------------------// Causes the helicopter to immediately accelerate to its desired velocity//-----------------------------------------------------------------------------void CBaseHelicopter::InputMoveTopSpeed( inputdata_t &inputdata ){ Vector vecVelocity; ComputeActualTargetPosition( GetMaxSpeed(), 1.0f, 0.0f, &vecVelocity, false ); vecVelocity -= GetAbsOrigin(); float flLength = VectorNormalize( vecVelocity ); if (flLength < 1e-3) { GetVectors( &vecVelocity, NULL, NULL ); } vecVelocity *= GetMaxSpeed(); SetAbsVelocity( vecVelocity );}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:18,
示例26: printfvoidon_notebook1_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data){ char ar[500]; extern char my_arena[]; /* need to fix these TODO *btw: the idea is this: if you click on the diag screen you get if(my_mode==-1) my_mode=page_num; printf("::::%d/n",my_mode); */ GetCurrentArena(ar); if(page_num == 0) { if(my_mode==1) return; my_mode=1; if(strcmp(ar,"")!=0) { Vector("",""); } return; } if(page_num==1) { if(my_mode==2) return; my_mode=2; if(strcmp(ar,"")==0) { Vector(my_arena,""); GetVectors(my_arena); } return; } if(page_num==2) { //if(my_mode==2) // my_mode=-1; GetMetrics(); }}
开发者ID:zipleen,项目名称:really-old-crap-from-cvs,代码行数:47,
示例27: GetVectors//-----------------------------------------------------------------------------// Purpose: Attaches the grub to the surface underneath its abdomen//-----------------------------------------------------------------------------void CNPC_AntlionGrub::AttachToSurface( void ){ // Get our downward direction Vector vecForward, vecRight, vecDown; GetVectors( &vecForward, &vecRight, &vecDown ); vecDown.Negate(); // Trace down to find a surface trace_t tr; UTIL_TraceLine( WorldSpaceCenter(), WorldSpaceCenter() + (vecDown*256.0f), MASK_NPCSOLID, this, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction < 1.0f ) { // Move there UTIL_SetOrigin( this, tr.endpos, false ); }}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:20,
示例28: GetAttachment// Атака зажигательными гранатами. Отключена. Для включения см. комментарий в ф-ции Spawn()// See the function and the and of npc_cremator.hvoid CNPC_Cremator::ThrowIncendiaryGrenade( void ){ Vector vecStart; GetAttachment( "anim_attachment_LH", vecStart ); Vector forward, up, right, vecThrow; GetVectors( &forward, &right, &up ); vecThrow = forward * 450 + up * 175 + right * random->RandomFloat(-15, 5); CGrenadeIncendiary *pIncendiary = (CGrenadeIncendiary*)Create( "grenade_incendiary", vecStart, vec3_angle, this ); pIncendiary->SetAbsVelocity( vecThrow ); pIncendiary->SetGravity( 1.5f ); pIncendiary->SetLocalAngularVelocity( RandomAngle( -400, 400 ) ); pIncendiary->SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); }
开发者ID:RaraFolf,项目名称:FIREFIGHT-RELOADED-src-sdk-2013,代码行数:19,
示例29: GetVectorsvoid CKeepUpright::Spawn(){ // align the object's local Z axis m_localTestAxis.Init( 0, 0, 1 ); // Use our Up axis so mapmakers can orient us arbitrarily GetVectors( NULL, NULL, &m_worldGoalAxis ); SetMoveType( MOVETYPE_NONE ); if ( m_spawnflags & SF_KEEPUPRIGHT_START_INACTIVE ) { m_bActive = false; } else { m_bActive = true; }}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:18,
示例30: GetAbsOrigin//-----------------------------------------------------------------------------// Purpose: Get our conditions for a melee attack// Input : flDot - // flDist - // Output : int//-----------------------------------------------------------------------------int CNPC_Ichthyosaur::MeleeAttack1Conditions( float flDot, float flDist ){ Vector predictedDir = ( (GetEnemy()->GetAbsOrigin()+(GetEnemy()->GetSmoothedVelocity())) - GetAbsOrigin() ); float flPredictedDist = VectorNormalize( predictedDir ); Vector vBodyDir; GetVectors( &vBodyDir, NULL, NULL ); float flPredictedDot = DotProduct( predictedDir, vBodyDir ); if ( flPredictedDot < 0.8f ) return COND_NOT_FACING_ATTACK; if ( ( flPredictedDist > ( GetAbsVelocity().Length() * 0.5f) ) && ( flDist > 128.0f ) ) return COND_TOO_FAR_TO_ATTACK; return COND_CAN_MELEE_ATTACK1;}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:24,
注:本文中的GetVectors函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetVehicle函数代码示例 C++ GetVectorForKey函数代码示例 |