您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ EyePosition函数代码示例

51自学网 2021-06-01 20:40:13
  C++
这篇教程C++ EyePosition函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中EyePosition函数的典型用法代码示例。如果您正苦于以下问题:C++ EyePosition函数的具体用法?C++ EyePosition怎么用?C++ EyePosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了EyePosition函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: acos

//-----------------------------------------------------------------------------// Purpose: //-----------------------------------------------------------------------------void CNPC_CombineCamera::DrawDebugGeometryOverlays(void){	// ------------------------------	// Draw viewcone if selected	// ------------------------------	if ((m_debugOverlays & OVERLAY_NPC_VIEWCONE_BIT))	{		float flViewRange	= acos(CAMERA_FOV_NARROW);		Vector vEyeDir = EyeDirection2D( );		Vector vLeftDir, vRightDir;		float fSin, fCos;		SinCos( flViewRange, &fSin, &fCos );		vLeftDir.x			= vEyeDir.x * fCos - vEyeDir.y * fSin;		vLeftDir.y			= vEyeDir.x * fSin + vEyeDir.y * fCos;		vLeftDir.z			=  vEyeDir.z;		fSin				= sin(-flViewRange);		fCos				= cos(-flViewRange);		vRightDir.x			= vEyeDir.x * fCos - vEyeDir.y * fSin;		vRightDir.y			= vEyeDir.x * fSin + vEyeDir.y * fCos;		vRightDir.z			=  vEyeDir.z;		NDebugOverlay::BoxDirection(EyePosition(), Vector(0,0,-40), Vector(200,0,40), vLeftDir, 255, 255, 0, 50, 0 );		NDebugOverlay::BoxDirection(EyePosition(), Vector(0,0,-40), Vector(200,0,40), vRightDir, 255, 255, 0, 50, 0 );		NDebugOverlay::Box(EyePosition(), -Vector(2,2,2), Vector(2,2,2), 255, 255, 0, 128, 0 );	}	BaseClass::DrawDebugGeometryOverlays();}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:32,


示例2: defined

bool CBaseCombatCharacter::IsLineOfSightClear( const Vector &pos, LineOfSightCheckType checkType, CBaseEntity *entityToIgnore ) const{#if defined(GAME_DLL) && defined(COUNT_BCC_LOS)	static int count, frame;	if ( frame != gpGlobals->framecount )	{		Msg( ">> %d/n", count );		frame = gpGlobals->framecount;		count = 0;	}	count++;#endif	if( checkType == IGNORE_ACTORS )	{		// use the query cache unless it causes problems		trace_t trace;		CTraceFilterNoCombatCharacters traceFilter( entityToIgnore, COLLISION_GROUP_NONE );		UTIL_TraceLine( EyePosition(), pos, MASK_OPAQUE | CONTENTS_IGNORE_NODRAW_OPAQUE | CONTENTS_MONSTER, &traceFilter, &trace );		return trace.fraction == 1.0f;	}	else	{		trace_t trace;		CTraceFilterSkipTwoEntities traceFilter( this, entityToIgnore, COLLISION_GROUP_NONE );		UTIL_TraceLine( EyePosition(), pos, MASK_OPAQUE | CONTENTS_IGNORE_NODRAW_OPAQUE, &traceFilter, &trace );		return trace.fraction == 1.0f;	}}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:33,


示例3: AngleVectors

//-----------------------------------------------------------------------------// Purpose: Sparks and fizzes to show it's broken.//-----------------------------------------------------------------------------void CNPC_RocketTurret::DeathThink( void ){	Vector vForward;	AngleVectors( m_vecCurrentAngles, &vForward, NULL, NULL );	m_iLaserState = 0;	SetEnemy( NULL );	g_pEffects->Sparks( EyePosition(), 1, 1, &vForward );	g_pEffects->Smoke( EyePosition(), 0, 6.0f, 20 );	SetNextThink( gpGlobals->curtime + RandomFloat( 2.0f, 8.0f ) );}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:16,


示例4: StopPowerjump

void 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,


示例5: AngleVectors

void C_HL2MP_Player::CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov ){	// third or first person ragdolls	if ( m_lifeState != LIFE_ALIVE && !IsObserver() )	{		// First person ragdolls		if ( cl_fp_ragdoll.GetBool() && m_hRagdoll.Get() )		{			// pointer to the ragdoll			C_HL2MPRagdoll *pRagdoll = (C_HL2MPRagdoll*)m_hRagdoll.Get();			// gets its origin and angles			pRagdoll->GetAttachment( pRagdoll->LookupAttachment( "eyes" ), eyeOrigin, eyeAngles );			Vector vForward; 			AngleVectors( eyeAngles, &vForward );			if ( cl_fp_ragdoll_auto.GetBool() )			{				// DM: Don't use first person view when we are very close to something				trace_t tr;				UTIL_TraceLine( eyeOrigin, eyeOrigin + ( vForward * 10000 ), MASK_ALL, pRagdoll, COLLISION_GROUP_NONE, &tr );				if ( (!(tr.fraction < 1) || (tr.endpos.DistTo(eyeOrigin) > 25)) )					return;			}			else				return;		}		eyeOrigin = vec3_origin;		eyeAngles = vec3_angle;		Vector origin = EyePosition();		IRagdoll *pRagdoll = GetRepresentativeRagdoll();		if ( pRagdoll )		{			origin = pRagdoll->GetRagdollOrigin();			origin.z += VEC_DEAD_VIEWHEIGHT.z; // look over ragdoll, not through		}		BaseClass::CalcView( eyeOrigin, eyeAngles, zNear, zFar, fov );		eyeOrigin = origin;		Vector vForward; 		AngleVectors( eyeAngles, &vForward );		VectorNormalize( vForward );		VectorMA( origin, -CHASE_CAM_DISTANCE, vForward, eyeOrigin );		Vector WALL_MIN( -WALL_OFFSET, -WALL_OFFSET, -WALL_OFFSET );		Vector WALL_MAX( WALL_OFFSET, WALL_OFFSET, WALL_OFFSET );		trace_t trace; // clip against world		// HACK don't recompute positions while doing RayTrace		C_BaseEntity::EnableAbsRecomputations( false );		UTIL_TraceHull( origin, eyeOrigin, WALL_MIN, WALL_MAX, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &trace );		C_BaseEntity::EnableAbsRecomputations( true );		if (trace.fraction < 1.0)		{			eyeOrigin = trace.endpos;		}		return;	}	BaseClass::CalcView( eyeOrigin, eyeAngles, zNear, zFar, fov );}
开发者ID:bmk10,项目名称:deathmatchclassicsource,代码行数:60,


示例6: IsAbleToSee

//-----------------------------------------------------------------------------// Purpose://-----------------------------------------------------------------------------bool CBaseCombatCharacter::IsAbleToSee( const CBaseEntity *pEntity, FieldOfViewCheckType checkFOV ){	CBaseCombatCharacter *pBCC = const_cast<CBaseEntity *>( pEntity )->MyCombatCharacterPointer();	if ( pBCC )		return IsAbleToSee( pBCC, checkFOV );	// Test this every time; it's cheap.	Vector vecEyePosition = EyePosition();	Vector vecTargetPosition = pEntity->WorldSpaceCenter();#ifdef GAME_DLL	Vector vecEyeToTarget;	VectorSubtract( vecTargetPosition, vecEyePosition, vecEyeToTarget );	float flDistToOther = VectorNormalize( vecEyeToTarget ); 	// We can't see because they are too far in the fog	if ( IsHiddenByFog( flDistToOther ) )		return false;#endif	if ( !ComputeLOS( vecEyePosition, vecTargetPosition ) )		return false;	return ( checkFOV != USE_FOV || IsInFieldOfView( vecTargetPosition ) );}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:30,


示例7: GetEyeVectors

void C_NEOPlayer::UpdateInCross(){	if ( !IsLocalNEOPlayer() )		return;	m_iInCrossIndex = 0;	m_bAnyoneInCross = false;	Vector forward;	GetEyeVectors( &forward, nullptr, nullptr );	Vector eyes = EyePosition();	Vector start = eyes + forward * 10.f;	Vector end = eyes + forward * 1500.f;	trace_t trace;	UTIL_TraceLine( start, end, CONTENTS_LADDER | CONTENTS_MOVEABLE | CONTENTS_GRATE | CONTENTS_AUX | CONTENTS_WINDOW | CONTENTS_SOLID, this, 0, &trace );	if ( !trace.startsolid && trace.DidHitNonWorldEntity() && trace.m_pEnt )	{		if ( trace.m_pEnt != this && trace.m_pEnt->IsPlayer() && trace.m_pEnt->GetTeamNumber() == this->GetTeamNumber() )		{			m_iInCrossIndex = trace.m_pEnt->entindex();			m_bAnyoneInCross = true;		}	}}
开发者ID:Ochii,项目名称:nt-revamp,代码行数:28,


示例8: ToBasePlayer

/**	Returns true if we are looking towards something within a tolerence determined 	by our field of view*/bool CBaseCombatCharacter::IsInFieldOfView( CBaseEntity *entity ) const{	CBasePlayer *pPlayer = ToBasePlayer( const_cast< CBaseCombatCharacter* >( this ) );	float flTolerance = pPlayer ? cos( (float)pPlayer->GetFOV() * 0.5f ) : BCC_DEFAULT_LOOK_TOWARDS_TOLERANCE;	Vector vecForward;	Vector vecEyePosition = EyePosition();	AngleVectors( EyeAngles(), &vecForward );	// FIXME: Use a faster check than this!	// Check 3 spots, or else when standing right next to someone looking at their eyes, 	// the angle will be too great to see their center.	Vector vecToTarget = entity->GetAbsOrigin() - vecEyePosition;	vecToTarget.NormalizeInPlace();	if ( DotProduct( vecForward, vecToTarget ) >= flTolerance )		return true;	vecToTarget = entity->WorldSpaceCenter() - vecEyePosition;	vecToTarget.NormalizeInPlace();	if ( DotProduct( vecForward, vecToTarget ) >= flTolerance )		return true;	vecToTarget = entity->EyePosition() - vecEyePosition;	vecToTarget.NormalizeInPlace();	return ( DotProduct( vecForward, vecToTarget ) >= flTolerance );}
开发者ID:EspyEspurr,项目名称:game,代码行数:31,


示例9: ToCFPlayer

void C_CFPlayer::CalcInEyeCamView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov){	C_CFPlayer *pTarget = ToCFPlayer(GetObserverTarget());	if ( !pTarget ) 	{		// just copy a save in-map position		VectorCopy( EyePosition(), eyeOrigin );		VectorCopy( EyeAngles(), eyeAngles );		return;	};	if ( pTarget->ShouldForceThirdPerson() )	{		CalcChaseCamView( eyeOrigin, eyeAngles, fov );		return;	}	fov = GetFOV();	// TODO use tragets FOV	m_flObserverChaseDistance = 0.0;	eyeAngles = pTarget->EyeAngles();	eyeOrigin = pTarget->EyePosition();	// Apply punch angle	VectorAdd( eyeAngles, GetPunchAngle(), eyeAngles );	engine->SetViewAngles( eyeAngles );}
开发者ID:BSVino,项目名称:Arcon,代码行数:30,


示例10: MAKE_STRING

//-----------------------------------------------------------------------------// Purpose: Input handler that makes the crow fly away.//-----------------------------------------------------------------------------void CNPC_Crow::InputFlyAway( inputdata_t &inputdata ){	string_t sTarget = MAKE_STRING( inputdata.value.String() );	if ( sTarget != NULL_STRING )// this npc has a target	{		CBaseEntity *pEnt = gEntList.FindEntityByName( NULL, sTarget );		if ( pEnt )		{			trace_t tr;			AI_TraceLine ( EyePosition(), pEnt->GetAbsOrigin(), MASK_NPCSOLID, this, COLLISION_GROUP_NONE, &tr );			if ( tr.fraction != 1.0f )				 return;			// Find the npc's initial target entity, stash it			SetGoalEnt( pEnt );		}	}	else		SetGoalEnt( NULL );	SetCondition( COND_CROW_FORCED_FLY );	SetCondition( COND_PROVOKED );}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:30,


示例11: GetEnemy

//-----------------------------------------------------------------------------// Purpose: Find the center of the target entity as seen through the specified portal// Input  : pPortal - The portal to look through// Output : Vector& output point in world space where the target *appears* to be as seen through the portal//-----------------------------------------------------------------------------bool CNPC_RocketTurret::FindAimPointThroughPortal( const CProp_Portal* pPortal, Vector* pVecOut ){ 	if ( pPortal && pPortal->m_bActivated )	{		CProp_Portal* pLinked = pPortal->m_hLinkedPortal.Get(); 		CBaseEntity*  pTarget = GetEnemy();		// Require that the portal is facing towards the beam to test through it		Vector vRocketToPortal, vPortalForward;		VectorSubtract ( pPortal->GetAbsOrigin(), EyePosition(), vRocketToPortal );		pPortal->GetVectors( &vPortalForward, NULL, NULL);		float fDot = DotProduct( vRocketToPortal, vPortalForward );		// Portal must be facing the turret, and have a linked partner		if ( fDot < 0.0f && pLinked && pLinked->m_bActivated && pTarget )		{			VMatrix matToPortalView = pLinked->m_matrixThisToLinked;			Vector vTargetAimPoint = pTarget->GetAbsOrigin() + (pTarget->WorldAlignMins() + pTarget->WorldAlignMaxs()) * 0.5f;			*pVecOut =  matToPortalView * vTargetAimPoint;   			return true;		}	}	// Bad portal pointer, not linked, no target or otherwise failed	return false;}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:31,


示例12: fabs

// here bot updates important info that is used multiple times along the thinking processvoid CSDKBot::InfoGathering(){	if (!GetEnemy())	{		m_flBotToEnemyDist = 9999;		m_flHeightDifToEnemy = 0;		m_bEnemyOnSights = false;		m_flDistTraveled += fabs(GetLocalVelocity().Length()); // this is used for stuck checking,		return;	}	m_flBotToEnemyDist = (GetLocalOrigin() - GetEnemy()->GetLocalOrigin()).Length();	trace_t tr;	UTIL_TraceHull( EyePosition(), GetEnemy()->EyePosition() - Vector(0,0,20), -BotTestHull, BotTestHull, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );	if( tr.m_pEnt == GetEnemy() ) // vision line between both		m_bEnemyOnSights = true;	else		m_bEnemyOnSights = false;	m_bInRangeToAttack = (m_flBotToEnemyDist < m_flMinRangeAttack) && FInViewCone( GetEnemy() );	m_flDistTraveled += fabs(GetLocalVelocity().Length()); // this is used for stuck checking,	m_flHeightDifToEnemy = GetLocalOrigin().z - GetEnemy()->GetLocalOrigin().z;}
开发者ID:rajeshpillai,项目名称:DoubleAction,代码行数:29,


示例13: defined

void CBasePlayer::CalcPlayerView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov ){#if defined( CLIENT_DLL )	if ( !prediction->InPrediction() )	{		// FIXME: Move into prediction		view->DriftPitch();	}#endif	VectorCopy( EyePosition(), eyeOrigin );#ifdef SIXENSE	if ( g_pSixenseInput->IsEnabled() )	{		VectorCopy( EyeAngles() + GetEyeAngleOffset(), eyeAngles );	}	else	{		VectorCopy( EyeAngles(), eyeAngles );	}#else	VectorCopy( EyeAngles(), eyeAngles );#endif#if defined( CLIENT_DLL )	if ( !prediction->InPrediction() )#endif	{		SmoothViewOnStairs( eyeOrigin );	}	// Snack off the origin before bob + water offset are applied	Vector vecBaseEyePosition = eyeOrigin;	CalcViewRoll( eyeAngles );	// Apply punch angle	VectorAdd( eyeAngles, m_Local.m_vecPunchAngle, eyeAngles );#if defined( CLIENT_DLL )	if ( !prediction->InPrediction() )	{		// Shake it up baby!		vieweffects->CalcShake();		vieweffects->ApplyShake( eyeOrigin, eyeAngles, 1.0 );	}#endif#if defined( CLIENT_DLL )	// Apply a smoothing offset to smooth out prediction errors.	Vector vSmoothOffset;	GetPredictionErrorSmoothingVector( vSmoothOffset );	eyeOrigin += vSmoothOffset;	m_flObserverChaseDistance = 0.0;#endif	// calc current FOV	fov = GetFOV();}
开发者ID:EspyEspurr,项目名称:game,代码行数:59,


示例14: return

bool CEntity::FVisible(CEntity *pEntity){    // don't look through water    if (IsInWater() != pEntity->IsInWater())        return false;    return (TestLine(EyePosition(), pEntity->EyePosition(), true, pEntity).fraction >= 1.0);}
开发者ID:CecilHarvey,项目名称:gina,代码行数:8,


示例15: EyePosition

void CCSBot::UpdateLookAt(){	Vector to = m_lookAtSpot - EyePosition();	Vector idealAngle = UTIL_VecToAngles(to);	idealAngle.x = 360.0f - idealAngle.x;	SetLookAngles(idealAngle.y, idealAngle.x);}
开发者ID:a1batross,项目名称:ReGameDLL_CS,代码行数:8,


示例16: GetEnemy

int CASW_Parasite::RangeAttack1Conditions( float flDot, float flDist ){	if ( gpGlobals->curtime < m_flNextAttack )		return 0;	if ( ( GetFlags() & FL_ONGROUND ) == false )		return 0;	// This code stops lots of headcrabs swarming you and blocking you	// whilst jumping up and down in your face over and over. It forces	// them to back up a bit. If this causes problems, consider using it	// for the fast headcrabs only, rather than just removing it.(sjb)	if ( flDist < ASW_PARASITE_MIN_JUMP_DIST )		return COND_TOO_CLOSE_TO_ATTACK;	if ( flDist > ASW_PARASITE_MAX_JUMP_DIST )		return COND_TOO_FAR_TO_ATTACK;	// Make sure the way is clear!	CBaseEntity *pEnemy = GetEnemy();	if( pEnemy )	{		bool bEnemyIsBullseye = ( dynamic_cast<CNPC_Bullseye *>(pEnemy) != NULL );		trace_t tr;		AI_TraceLine( EyePosition(), pEnemy->EyePosition(), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );		if ( tr.m_pEnt != GetEnemy() )		{			if ( !bEnemyIsBullseye || tr.m_pEnt != NULL )				return COND_NONE;		}		if( GetEnemy()->EyePosition().z - 36.0f > GetAbsOrigin().z )		{			// Only run this test if trying to jump at a player who is higher up than me, else this 			// code will always prevent a headcrab from jumping down at an enemy, and sometimes prevent it			// jumping just slightly up at an enemy.			Vector vStartHullTrace = GetAbsOrigin();			vStartHullTrace.z += 1.0;			Vector vEndHullTrace = GetEnemy()->EyePosition() - GetAbsOrigin();			vEndHullTrace.NormalizeInPlace();			vEndHullTrace *= 8.0;			vEndHullTrace += GetAbsOrigin();			AI_TraceHull( vStartHullTrace, vEndHullTrace,GetHullMins(), GetHullMaxs(), MASK_NPCSOLID, this, GetCollisionGroup(), &tr );			if ( tr.m_pEnt != NULL && tr.m_pEnt != GetEnemy() )			{				return COND_TOO_CLOSE_TO_ATTACK;			}		}	}	return COND_CAN_RANGE_ATTACK1;}
开发者ID:detoxhby,项目名称:SwarmDirector2,代码行数:57,


示例17: EyePosition

//-----------------------------------------------------------------------------// Purpose: // Input  : eyeOrigin - //			eyeAngles - //			zNear - //			zFar - //			fov - //-----------------------------------------------------------------------------void CBasePlayer::CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov ){	eyeOrigin = EyePosition();	eyeAngles = EyeAngles();#if defined( CLIENT_DLL )	Camera()->CalcView(eyeOrigin, eyeAngles, fov);#endif}
开发者ID:iosoccer,项目名称:iosoccer-game,代码行数:17,


示例18: StudioFrameAdvance

//-----------------------------------------------------------------------------// Make sure our target is still valid, and if so, fire at it//-----------------------------------------------------------------------------void CObjectSentrygun::Attack(){	StudioFrameAdvance( );	if ( !FindTarget() )	{		m_iState.Set( SENTRY_STATE_SEARCHING );		m_hEnemy = NULL;		return;	}	// Track enemy	Vector vecMid = EyePosition();	Vector vecMidEnemy = m_hEnemy->WorldSpaceCenter();	Vector vecDirToEnemy = vecMidEnemy - vecMid;	QAngle angToTarget;	VectorAngles( vecDirToEnemy, angToTarget );	angToTarget.y = UTIL_AngleMod( angToTarget.y );	if (angToTarget.x < -180)		angToTarget.x += 360;	if (angToTarget.x > 180)		angToTarget.x -= 360;	// now all numbers should be in [1...360]	// pin to turret limitations to [-50...50]	if (angToTarget.x > 50)		angToTarget.x = 50;	else if (angToTarget.x < -50)		angToTarget.x = -50;	m_vecGoalAngles.y = angToTarget.y;	m_vecGoalAngles.x = angToTarget.x;	MoveTurret();	// Fire on the target if it's within 10 units of being aimed right at it	if ( m_flNextAttack <= gpGlobals->curtime && (m_vecGoalAngles - m_vecCurAngles).Length() <= 10 )	{		Fire();		if ( m_iUpgradeLevel == 1 )		{			// Level 1 sentries fire slower			m_flNextAttack = gpGlobals->curtime + 0.2;		}		else		{			m_flNextAttack = gpGlobals->curtime + 0.1;		}	}	else	{		// SetSentryAnim( TFTURRET_ANIM_SPIN );	}}
开发者ID:MrBoomer568,项目名称:TF2Classic,代码行数:59,


示例19: FVisible

//=========================================================// FVisible - returns true if a line can be traced from// the caller's eyes to the target vector//=========================================================BOOL CBaseEntity :: FVisible ( const Vector &vecOrigin ){	TraceResult tr;	Vector		vecLookerOrigin;		vecLookerOrigin = EyePosition();//look through the caller's 'eyes'    return AvHCheckLineOfSight(vecLookerOrigin, vecOrigin, ENT(pev));}
开发者ID:Arkshine,项目名称:NS,代码行数:14,


示例20: EyePosition

/**	Return true if our view direction is pointing at the given target, 	within the cosine of the angular tolerance. LINE OF SIGHT IS NOT CHECKED.*/bool CBaseCombatCharacter::IsLookingTowards( const Vector &target, float cosTolerance ) const{	Vector toTarget = target - EyePosition();	toTarget.NormalizeInPlace();	Vector forward;	AngleVectors( EyeAngles(), &forward );	return ( DotProduct( forward, toTarget ) >= cosTolerance );}
开发者ID:EspyEspurr,项目名称:game,代码行数:14,


示例21: 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,


示例22: CHL2MPFlashlightEffect

//-----------------------------------------------------------------------------// Purpose: Creates, destroys, and updates the flashlight effect as needed.//-----------------------------------------------------------------------------void C_HL2MP_Player::UpdateFlashlight(){	// The dim light is the flashlight.	if ( IsEffectActive( EF_DIMLIGHT ) )	{		if (!m_pHL2MPFlashLightEffect)		{			// Turned on the headlight; create it.			m_pHL2MPFlashLightEffect = new CHL2MPFlashlightEffect(index);			if (!m_pHL2MPFlashLightEffect)				return;			m_pHL2MPFlashLightEffect->TurnOn();		}		Vector vecForward, vecRight, vecUp;		Vector position = EyePosition();		if ( ::input->CAM_IsThirdPerson() )		{			int iAttachment = LookupAttachment( "anim_attachment_RH" );			if ( iAttachment >= 0 )			{				Vector vecOrigin;				//Tony; EyeAngles will return proper whether it's local player or not.				QAngle eyeAngles = EyeAngles();				GetAttachment( iAttachment, vecOrigin, eyeAngles );				Vector vForward;				AngleVectors( eyeAngles, &vecForward, &vecRight, &vecUp );				position = vecOrigin;			}			else				EyeVectors( &vecForward, &vecRight, &vecUp );		}		else			EyeVectors( &vecForward, &vecRight, &vecUp );		// Update the light with the new position and direction.				m_pHL2MPFlashLightEffect->UpdateLight( position, vecForward, vecRight, vecUp, FLASHLIGHT_DISTANCE );	}	else if (m_pHL2MPFlashLightEffect)	{		// Turned off the flashlight; delete it.		delete m_pHL2MPFlashLightEffect;		m_pHL2MPFlashLightEffect = NULL;	}}
开发者ID:uunx,项目名称:quakelife2,代码行数:55,


示例23: MakeVectors

bool Bot::IsFriendInLineOfFire (float distance){   // bot can't hurt teammates, if friendly fire is not enabled...   if (!engine->IsFriendlyFireOn ())      return false;   MakeVectors (pev->v_angle);   TraceResult tr;   TraceLine (EyePosition (), EyePosition () + pev->v_angle.Normalize () * distance, false, false, GetEntity (), &tr);   // check if we hit something   if (!FNullEnt (tr.pHit))   {      int playerIndex = ENTINDEX (tr.pHit) - 1;      // check valid range      if (playerIndex >= 0 && playerIndex < engine->GetMaxClients () && g_clients[playerIndex].team == GetTeam (GetEntity ()) && (g_clients[playerIndex].flags & CFLAG_ALIVE))         return true;   }   // search the world for players   for (int i = 0; i < engine->GetMaxClients (); i++)   {      if (!(g_clients[i].flags & CFLAG_USED) || !(g_clients[i].flags & CFLAG_ALIVE) || g_clients[i].team != GetTeam (GetEntity ()) || g_clients[i].ent == GetEntity ())         continue;      edict_t *ent = g_clients[i].ent;      float friendDistance = (GetEntityOrigin (ent) - pev->origin).GetLength ();      float squareDistance = sqrtf (1089.0f + (friendDistance * friendDistance));      if ((GetShootingConeDeviation (GetEntity (), &GetEntityOrigin (ent))) > 		  ((friendDistance * friendDistance) / (squareDistance * squareDistance)) && 		  friendDistance <= distance)         return true;   }   return false;}
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:39,


示例24: EyePosition

//=========================================================// FVisible - returns true if a line can be traced from// the caller's eyes to the target vector//=========================================================bool CNPC_Bullsquid::FVisible ( Vector vecOrigin ){	trace_t tr;	Vector		vecLookerOrigin;		vecLookerOrigin = EyePosition();//look through the caller's 'eyes'	UTIL_TraceLine(vecLookerOrigin, vecOrigin, MASK_BLOCKLOS, this/*pentIgnore*/, COLLISION_GROUP_NONE, &tr);		if ( tr.fraction != 1.0 )		 return false; // Line of sight is not established	else		 return true;// line of sight is valid.}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:17,


示例25: CorrectGun

// SyPB Pro P.21 - New Shootable Thru Obstaclebool Bot::IsShootableThruObstacle (Vector dest){	if (m_skill < 70)		return false;	int currentWeaponPenetrationPower = CorrectGun (m_currentWeapon);	if (currentWeaponPenetrationPower == 0)		return false;	TraceResult tr;	Vector source = EyePosition ();	float obstacleDistance = 0.0f;	TraceLine (source, dest, true, GetEntity (), &tr);	if (tr.fStartSolid)	{		source = tr.vecEndPos;		TraceLine (dest, source, true, GetEntity (), &tr);		if (tr.flFraction != 1.0f)		{			if (((tr.vecEndPos - dest).GetLength ()) > 800)				return false;			// SyPB Pro P.22 - Strengthen Shootable Thru Obstacle			if (tr.vecEndPos.z >= dest.z + 200)				return false;			obstacleDistance = (tr.vecEndPos - source).GetLength ();		}	}	if (obstacleDistance > 0.0)	{		while (currentWeaponPenetrationPower > 0)		{			if (obstacleDistance > 75.0)			{				obstacleDistance -= 75.0f;				currentWeaponPenetrationPower--;				continue;			}			return true;		}	}	return false;}
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:52,



注:本文中的EyePosition函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ F函数代码示例
C++ EyeAngles函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。