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

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

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

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

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

示例1: GetAbsOrigin

void C_CFPlayer::UpdateClientSideAnimation(){	// Update the animation data. It does the local check here so this works when using	// a third-person camera (and we don't have valid player angles).	if ( this == C_CFPlayer::GetLocalCFPlayer() )	{		if (m_hReviving != NULL || m_hReviver != NULL)		{			C_CFPlayer* pTarget = m_hReviving;			if (!pTarget)				pTarget = m_hReviver;			// Snap the animation to face the model during fatalities.			Vector vecToTarget = pTarget->GetAbsOrigin() - GetAbsOrigin();			QAngle angToTarget;			VectorAngles(vecToTarget, angToTarget);			m_PlayerAnimState->Update( angToTarget[YAW], angToTarget[PITCH] );		}		else			m_PlayerAnimState->Update( EyeAngles()[YAW], EyeAngles()[PITCH] );	}	else		m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );	BaseClass::UpdateClientSideAnimation();}
开发者ID:BSVino,项目名称:Arcon,代码行数:27,


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


示例3: GetLocalAngles

void C_MSS_Player::PreThink( void ){	QAngle vTempAngles = GetLocalAngles();	if ( GetLocalPlayer() == this )	{		vTempAngles[PITCH] = EyeAngles()[PITCH];	}	else	{		vTempAngles[PITCH] = m_angEyeAngles[PITCH];	}	if ( vTempAngles[YAW] < 0.0f )	{		vTempAngles[YAW] += 360.0f;	}	SetLocalAngles( vTempAngles );	BaseClass::PreThink();	HandleSpeedChanges();	if ( m_HL2Local.m_flSuitPower <= 0.0f )	{		if( IsSprinting() )		{			StopSprinting();		}	}}
开发者ID:BoXorz,项目名称:MSS,代码行数:32,


示例4: GetVehicle

//-----------------------------------------------------------------------------// Purpose: Returns the eye position and angle vectors.//-----------------------------------------------------------------------------void CBasePlayer::EyePositionAndVectors( Vector *pPosition, Vector *pForward,										 Vector *pRight, Vector *pUp ){#ifdef CLIENT_DLL	IClientVehicle *pVehicle = GetVehicle();#else	IServerVehicle *pVehicle = GetVehicle();#endif	if ( pVehicle )	{		Assert( pVehicle );		int nRole = pVehicle->GetPassengerRole( this );		Vector vecEyeOrigin;		QAngle angEyeAngles;		pVehicle->GetVehicleViewPosition( nRole, pPosition, &angEyeAngles );		AngleVectors( angEyeAngles, pForward, pRight, pUp );	}	else	{		VectorCopy( BaseClass::EyePosition(), *pPosition );		AngleVectors( EyeAngles(), pForward, pRight, pUp );	}}
开发者ID:paralin,项目名称:hl2sdk,代码行数:29,


示例5: IsLocalPlayer

void C_SDKPlayer::LookAtBall(void){	const QAngle camAngles = IsLocalPlayer() ? ::input->GetCameraAngles() : m_angCamViewAngles;	float yaw = camAngles[YAW] - EyeAngles()[YAW];	float pitch = camAngles[PITCH];	if (yaw > 180) yaw -= 360;	if (yaw < -180) yaw += 360;	if (pitch > 180) pitch -= 360;	if (pitch < -180) pitch += 360;	//if (yaw > 90) yaw = 180 - yaw;	//if (yaw < -90) yaw = -180 - yaw;	pitch = clamp(pitch, -60, 60);	yaw = clamp(yaw, -120, 120);	float neckVal = clamp(yaw, -50, 50);	SetBoneController(2, neckVal); // Neck	yaw -= neckVal;	float upperSpineVal = clamp(yaw, -40, 40);	SetBoneController(1, upperSpineVal); // Upper spine	yaw -= upperSpineVal;	float lowerSpineVal = clamp(yaw, -30, 30);	SetBoneController(0, lowerSpineVal); // Lower spine	SetBoneController(3, pitch);}
开发者ID:iosoccer,项目名称:iosoccer-game,代码行数:30,


示例6: AngleVectors

//=========================================================// Autoaim// set crosshair position to point to enemey//=========================================================Vector C_HL2MP_Player::GetAutoaimVector( float flDelta ){	// Never autoaim a predicted weapon (for now)	Vector	forward;	AngleVectors( EyeAngles() + m_Local.m_vecPunchAngle, &forward );	return	forward;}
开发者ID:uunx,项目名称:quakelife2,代码行数:11,


示例7: EyeAngles

void C_MSS_Player::PostThink( void ){	BaseClass::PostThink();	// Store the eye angles pitch so the client can compute its animation state correctly.	m_angEyeAngles = EyeAngles();}
开发者ID:BoXorz,项目名称:MSS,代码行数:7,


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


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


示例10: SetCollisionBounds

void CHL2MP_Player::PostThink( void ){	BaseClass::PostThink();		if ( GetFlags() & FL_DUCKING )	{		SetCollisionBounds( VEC_CROUCH_TRACE_MIN, VEC_CROUCH_TRACE_MAX );	}	m_PlayerAnimState.Update();	// Store the eye angles pitch so the client can compute its animation state correctly.	m_angEyeAngles = EyeAngles();	QAngle angles = GetLocalAngles();	angles[PITCH] = 0;	SetLocalAngles( angles );	if (!IsDead())	{		if (m_afButtonReleased & IN_KICK && m_flNextKickAttack < gpGlobals->curtime /* && m_flNextKickAttack < gpGlobals->curtime  && !m_bIsKicking*/)		{			KickAttack();			m_bIsKicking = true;		}	}	CBaseCombatWeapon *pWeapon = this->GetActiveWeapon();	if (pWeapon != NULL)	{		if (m_afButtonPressed & IN_IRONSIGHT)		{			pWeapon->EnableIronsights();		}		else if (m_afButtonReleased & IN_IRONSIGHT)		{			pWeapon->DisableIronsights();		}	}	if (!IsDead())	{		if (m_flNextKickAttack < gpGlobals->curtime)		{			m_bIsKicking = false;			CBaseViewModel *vm = GetViewModel(1);			if (vm)			{				int	idealSequence = vm->SelectWeightedSequence(ACT_VM_IDLE);				if (idealSequence >= 0)				{					vm->SendViewModelMatchingSequence(idealSequence);				}			}		}	}}
开发者ID:RaraFolf,项目名称:FIREFIGHT-RELOADED-src-sdk-2013,代码行数:59,


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


示例12: EyeAngles

void C_NEOPlayer::UpdateClientSideAnimation(){	if ( this == GetLocalNEOPlayer() )		m_PlayerAnimState->Update( EyeAngles()[ YAW ], m_angEyeAngles[ PITCH ] );	else		m_PlayerAnimState->Update( m_angEyeAngles[ YAW ], m_angEyeAngles[ PITCH ] );	C_BaseAnimating::UpdateClientSideAnimation();}
开发者ID:Ochii,项目名称:nt-revamp,代码行数:9,


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


示例14: EyeAngles

void C_SDKPlayer::UpdateClientSideAnimation(){	// Update the animation data. It does the local check here so this works when using	// a third-person camera (and we don't have valid player angles).	if ( this == C_SDKPlayer::GetLocalSDKPlayer() )		m_PlayerAnimState->Update( EyeAngles()[YAW], m_angEyeAngles[PITCH] );	else		m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );	BaseClass::UpdateClientSideAnimation();}
开发者ID:Epic-xx,项目名称:impending,代码行数:11,


示例15: DETOUR_DECL_MEMBER

	/* CTFBotMvMEngineerIdle::Update static_cast's the owner of the sentry hint	 * to a CObjectSentrygun and calls GetTurretAngles, which doesn't exist for	 * CObjectDispenser; this tweak should avoid the problem */	DETOUR_DECL_MEMBER(const QAngle&, CObjectDispenser_GetAvailableMetal)	{		TRACE();				if (rc_CTFBotMvMEngineerIdle_Update > 0) {			TRACE_MSG("in CTFBotMvMEngineerIdle::Update");			auto obj = reinterpret_cast<CBaseEntity *>(this);			return obj->EyeAngles();		}				return DETOUR_MEMBER_CALL(CObjectDispenser_GetAvailableMetal)();	}
开发者ID:sigsegv-mvm,项目名称:sigsegv-mvm,代码行数:15,


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


示例17: GetLocalAngles

void CSDKPlayer::PostThink(){	BaseClass::PostThink();	QAngle angles = GetLocalAngles();	angles[PITCH] = 0;	SetLocalAngles( angles );		// Store the eye angles pitch so the client can compute its animation state correctly.	m_angEyeAngles = EyeAngles();    m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );}
开发者ID:paralin,项目名称:hl2sdk,代码行数:13,


示例18: GetLocalAngles

void CBaseNetworkedPlayer::PostThink(){	BaseClass::PostThink();	// Keep the model upright; pose params will handle pitch aiming.	QAngle angles = GetLocalAngles();	angles[PITCH] = 0;	SetLocalAngles(angles);	m_angEyeAngles = EyeAngles();	m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );}
开发者ID:DonnaLisa,项目名称:swarm-deferred,代码行数:13,


示例19: SetCollisionBounds

void CHL2MP_Player::PostThink( void ){	BaseClass::PostThink();		if ( GetFlags() & FL_DUCKING )		SetCollisionBounds( VEC_CROUCH_TRACE_MIN, VEC_CROUCH_TRACE_MAX );	QAngle angles = GetLocalAngles();	angles[PITCH] = 0;	SetLocalAngles( angles );	// Store the eye angles pitch so the client can compute its animation state correctly.	m_angEyeAngles = EyeAngles();	m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );}
开发者ID:Orygin,项目名称:BisounoursParty,代码行数:15,


示例20: VPROF

//-----------------------------------------------------------------------------// Purpose: Called every usercmd by the player PostThink//-----------------------------------------------------------------------------void CBasePlayer::ItemPostFrame(){	VPROF( "CBasePlayer::ItemPostFrame" );	// Put viewmodels into basically correct place based on new player origin	CalcViewModelView( EyePosition(), EyeAngles() );	// check if the player is using something	if ( m_hUseEntity != NULL )	{#if !defined( CLIENT_DLL )		ImpulseCommands();// this will call playerUse#endif		return;	}    if ( gpGlobals->curtime < m_flNextAttack )	{		if ( GetActiveWeapon() )		{			GetActiveWeapon()->ItemBusyFrame();		}	}	else	{		if ( GetActiveWeapon() )		{#if defined( CLIENT_DLL )			// Not predicting this weapon			if ( GetActiveWeapon()->IsPredicted() )#endif			{				GetActiveWeapon()->ItemPostFrame( );			}		}	}#if !defined( CLIENT_DLL )	ImpulseCommands();#else	// NOTE: If we ever support full impulse commands on the client,	// remove this line and call ImpulseCommands instead.	m_nImpulse = 0;#endif}
开发者ID:EspyEspurr,项目名称:game,代码行数:49,


示例21: AngleVectors

Vector CSDKPlayer::EyePosition(){	Vector vecPosition = BaseClass::EyePosition();	bool bIsInThird = false;#ifdef CLIENT_DLL	bIsInThird = ::input->CAM_IsThirdPerson();	if (C_SDKPlayer::GetLocalOrSpectatedPlayer() ==  this && C_SDKPlayer::GetLocalSDKPlayer() != C_SDKPlayer::GetLocalOrSpectatedPlayer())		bIsInThird = false;#endif	if (m_Shared.m_flViewBobRamp && m_Shared.m_flRunSpeed && !bIsInThird)	{		Vector vecRight, vecUp;		AngleVectors(EyeAngles(), NULL, &vecRight, &vecUp);		float flViewBobMagnitude = m_Shared.m_flViewBobRamp * da_viewbob.GetFloat();		float flRunPeriod = M_PI * 3;		float flRunUpBob = sin(GetCurrentTime() * flRunPeriod * 2) * (flViewBobMagnitude / 2);		float flRunRightBob = sin(GetCurrentTime() * flRunPeriod) * flViewBobMagnitude;		float flWalkPeriod = M_PI * 1.5f;		float flWalkUpBob = sin(GetCurrentTime() * flWalkPeriod * 2) * (flViewBobMagnitude / 2);		float flWalkRightBob = sin(GetCurrentTime() * flWalkPeriod) * flViewBobMagnitude;#ifdef CLIENT_DLL		// It's not filled in for remote clients, so force the local one since it's the same.		float flSpeedRatio = C_SDKPlayer::GetLocalSDKPlayer()->m_Shared.m_flAimInSpeed/C_SDKPlayer::GetLocalSDKPlayer()->m_Shared.m_flRunSpeed;#else		float flSpeedRatio = m_Shared.m_flAimInSpeed/m_Shared.m_flRunSpeed;#endif		// 0 is walk, 1 is run.		float flRunRamp = RemapValClamped(m_Shared.m_flViewBobRamp, flSpeedRatio, 1.0f, 0.0f, 1.0f);		float flRightBob = RemapValClamped(flRunRamp, 0, 1, flWalkRightBob, flRunRightBob);		float flUpBob = RemapValClamped(flRunRamp, 0, 1, flWalkUpBob, flRunUpBob);		vecPosition += vecRight * flRightBob + vecUp * flUpBob;	}	return vecPosition;}
开发者ID:jlwitthuhn,项目名称:DoubleAction,代码行数:46,


示例22: GetLocalAngles

void CHL2MP_Player::PreThink( void ){	QAngle vOldAngles = GetLocalAngles();	QAngle vTempAngles = GetLocalAngles();	vTempAngles = EyeAngles();	if ( vTempAngles[PITCH] > 180.0f )	{		vTempAngles[PITCH] -= 360.0f;	}	SetLocalAngles( vTempAngles );	BaseClass::PreThink();	State_PreThink();	//Reset bullet force accumulator, only lasts one frame	m_vecTotalBulletForce = vec3_origin;	SetLocalAngles( vOldAngles );}
开发者ID:RaraFolf,项目名称:FIREFIGHT-RELOADED-src-sdk-2013,代码行数:21,


示例23: GetLocalAngles

void C_HL2MP_Player::PreThink( void ){	QAngle vTempAngles = GetLocalAngles();	if ( GetLocalPlayer() == this )	{		vTempAngles[PITCH] = EyeAngles()[PITCH];	}	else	{		vTempAngles[PITCH] = m_angEyeAngles[PITCH];	}	if ( vTempAngles[YAW] < 0.0f )	{		vTempAngles[YAW] += 360.0f;	}	SetLocalAngles( vTempAngles );	BaseClass::PreThink();}
开发者ID:SteamLUG,项目名称:steamlug-7dfps-2013,代码行数:22,


示例24: ToSDKPlayer

void CDAViewModel::AddViewModelBob( CBasePlayer *owner, Vector& eyePosition, QAngle& eyeAngles ){	CSDKPlayer* pOwner = ToSDKPlayer(owner);	if (!pOwner)		return;	CWeaponSDKBase* pWeapon = GetDAWeapon();	if (pWeapon && pWeapon->IsThrowingGrenade())	{		float flThrowStart = GetDAWeapon()->GetGrenadeThrowStart();		float flHolsterTime = GetDAWeapon()->GetGrenadeThrowWeaponHolsterTime();		float flDeployTime = GetDAWeapon()->GetGrenadeThrowWeaponDeployTime();		float flThrowEnd = GetDAWeapon()->GetGrenadeThrowEnd();		float flGain = 0.7f;		if (pOwner->GetCurrentTime() < flHolsterTime)		{			eyePosition -= Vector(0, 0, 1) * RemapGainedValClamped( pOwner->GetCurrentTime(), flGain, flThrowStart, flHolsterTime, 0, da_weapon_grenadethrow_drop.GetFloat());			eyeAngles.x += RemapGainedValClamped( pOwner->GetCurrentTime(), flGain, flThrowStart, flHolsterTime, 0, da_weapon_grenadethrow_tilt.GetFloat());		}		else if (pOwner->GetCurrentTime() > flDeployTime)		{			eyePosition -= Vector(0, 0, 1) * RemapGainedValClamped( pOwner->GetCurrentTime(), flGain, flDeployTime, flThrowEnd, da_weapon_grenadethrow_drop.GetFloat(), 0);			eyeAngles.x += RemapGainedValClamped( pOwner->GetCurrentTime(), flGain, flDeployTime, flThrowEnd, da_weapon_grenadethrow_tilt.GetFloat(), 0);		}	}	// Offset it a tad so that it moves while looking around.	eyePosition.x += da_weaponoffset.GetFloat();	// For mysterious reasons that I don't care to investigate, the eye angles	// are sometimes slammed to (0, 0, 0) for a frame or two. If this should	// happen, use the previous eye angles instead.	QAngle angEye = EyeAngles();	if (angEye.x == 0 && angEye.y == 0 && angEye.z == 0)		angEye = m_angLastPlayerEyeAngles;	else		m_angLastPlayerEyeAngles = angEye;	Vector vecViewForward, vecViewRight, vecViewUp;	AngleVectors(angEye, &vecViewForward, &vecViewRight, &vecViewUp);	Vector vecViewDirection(vecViewForward.x, vecViewForward.y, 0);	vecViewDirection.NormalizeInPlace();	float flMaxVelocity = 100;	Vector vecOwnerVelocity = pOwner->GetAbsVelocity();	if (vecOwnerVelocity.LengthSqr() > flMaxVelocity*flMaxVelocity)		vecOwnerVelocity = (vecOwnerVelocity / vecOwnerVelocity.Length()) * flMaxVelocity;	m_vecPlayerVelocityLerp.x = Approach(vecOwnerVelocity.x, m_vecPlayerVelocityLerp.x, 1000*gpGlobals->frametime);	m_vecPlayerVelocityLerp.y = Approach(vecOwnerVelocity.y, m_vecPlayerVelocityLerp.y, 1000*gpGlobals->frametime);	m_vecPlayerVelocityLerp.z = Approach(vecOwnerVelocity.z, m_vecPlayerVelocityLerp.z, 1000*gpGlobals->frametime);	Vector vecPlayerVelocityLerp = m_vecPlayerVelocityLerp;	vecPlayerVelocityLerp.NormalizeInPlace();	float flViewVelocityDot = fabs(vecPlayerVelocityLerp.Dot(vecViewRight));	eyePosition += m_vecPlayerVelocityLerp * da_weaponlag.GetFloat() * flViewVelocityDot;	if (pOwner->m_Shared.GetViewBobRamp() && pOwner->m_Shared.GetRunSpeed())	{		float flViewBobMagnitude = pOwner->m_Shared.GetViewBobRamp() * da_weaponbob.GetFloat();		float flRunPeriod = M_PI * 3;		float flRunUpBob = sin(pOwner->GetCurrentTime() * flRunPeriod * 2) * (flViewBobMagnitude / 2);		float flRunRightBob = sin(pOwner->GetCurrentTime() * flRunPeriod) * flViewBobMagnitude;		float flWalkPeriod = M_PI * 1.5f;		float flWalkUpBob = sin(pOwner->GetCurrentTime() * flWalkPeriod * 2) * (flViewBobMagnitude / 2);		float flWalkRightBob = sin(pOwner->GetCurrentTime() * flWalkPeriod) * flViewBobMagnitude;		// 0 is walk, 1 is run.		float flRunRamp = RemapValClamped(pOwner->m_Shared.GetViewBobRamp(), pOwner->m_Shared.GetAimInSpeed()/pOwner->m_Shared.GetRunSpeed(), 1.0f, 0.0f, 1.0f);		float flRightBob = RemapValClamped(flRunRamp, 0, 1, flWalkRightBob, flRunRightBob);		float flUpBob = RemapValClamped(flRunRamp, 0, 1, flWalkUpBob, flRunUpBob);		eyePosition += vecViewRight * flRightBob + vecViewUp * (flUpBob - pOwner->m_Shared.GetViewBobRamp() * da_weapondrop.GetFloat());	}	if (pOwner->m_Shared.GetViewTilt())	{		Vector vecDiveRight = Vector(0, 0, 1).Cross(pOwner->m_Shared.GetDiveDirection());		float flRightDot = vecViewDirection.Dot(vecDiveRight);		float flUpDot = vecViewDirection.Dot(pOwner->m_Shared.GetDiveDirection());		eyeAngles.z += flRightDot * pOwner->m_Shared.GetViewTilt() * da_weapontilt.GetFloat();;		eyePosition += (vecViewUp * (flUpDot * 0.5f) + vecViewDirection * (flUpDot * 0.5f)) * pOwner->m_Shared.GetViewTilt();		float flDiveBobMagnitude = 0.5f * pOwner->m_Shared.GetViewTilt();		float flDiveBobPeriod = M_PI * 0.5f;		float flDiveUpBob = sin(pOwner->GetCurrentTime() * flDiveBobPeriod * 2) * (flDiveBobMagnitude / 2);		float flDiveRightBob = cos(pOwner->GetCurrentTime() * flDiveBobPeriod * 2) * (flDiveBobMagnitude / 2);		eyePosition += vecViewRight * flDiveRightBob + vecViewUp * flDiveUpBob;	}//.........这里部分代码省略.........
开发者ID:JorgeChimendes,项目名称:DoubleAction,代码行数:101,


示例25: EyeAngles

void C_HL2MP_Player::UpdateClientSideAnimation(){	m_PlayerAnimState->Update( EyeAngles()[YAW], EyeAngles()[PITCH] );	BaseClass::UpdateClientSideAnimation();}
开发者ID:uunx,项目名称:quakelife2,代码行数:6,


示例26: ReleaseFlashlight

//-----------------------------------------------------------------------------// Purpose: //-----------------------------------------------------------------------------void C_HL2MP_Player::AddEntity( void ){	BaseClass::AddEntity();	//Tony; modified so third person can do the beam too.	if ( IsEffectActive( EF_DIMLIGHT ) )	{		//Tony; if local player, not in third person, and there's a beam, destroy it. It will get re-created if they go third person again.		if ( this == C_BasePlayer::GetLocalPlayer() && !::input->CAM_IsThirdPerson() && m_pFlashlightBeam != NULL )		{			ReleaseFlashlight();			return;		}		else if( this != C_BasePlayer::GetLocalPlayer() || ::input->CAM_IsThirdPerson() )		{			int iAttachment = LookupAttachment( "anim_attachment_RH" );			if ( iAttachment < 0 )				return;			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, &vForward );			trace_t tr;			UTIL_TraceLine( vecOrigin, vecOrigin + (vForward * 200), MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );			if( !m_pFlashlightBeam )			{				BeamInfo_t beamInfo;				beamInfo.m_nType = TE_BEAMPOINTS;				beamInfo.m_vecStart = tr.startpos;				beamInfo.m_vecEnd = tr.endpos;				beamInfo.m_pszModelName = "sprites/glow01.vmt";				beamInfo.m_pszHaloName = "sprites/glow01.vmt";				beamInfo.m_flHaloScale = 3.0;				beamInfo.m_flWidth = 8.0f;				beamInfo.m_flEndWidth = 35.0f;				beamInfo.m_flFadeLength = 300.0f;				beamInfo.m_flAmplitude = 0;				beamInfo.m_flBrightness = 60.0;				beamInfo.m_flSpeed = 0.0f;				beamInfo.m_nStartFrame = 0.0;				beamInfo.m_flFrameRate = 0.0;				beamInfo.m_flRed = 255.0;				beamInfo.m_flGreen = 255.0;				beamInfo.m_flBlue = 255.0;				beamInfo.m_nSegments = 8;				beamInfo.m_bRenderable = true;				beamInfo.m_flLife = 0.5;				beamInfo.m_nFlags = FBEAM_FOREVER | FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM;				m_pFlashlightBeam = beams->CreateBeamPoints( beamInfo );			}			if( m_pFlashlightBeam )			{				BeamInfo_t beamInfo;				beamInfo.m_vecStart = tr.startpos;				beamInfo.m_vecEnd = tr.endpos;				beamInfo.m_flRed = 255.0;				beamInfo.m_flGreen = 255.0;				beamInfo.m_flBlue = 255.0;				beams->UpdateBeamInfo( m_pFlashlightBeam, beamInfo );				//Tony; local players don't make the dlight.				if( this != C_BasePlayer::GetLocalPlayer() )				{					dlight_t *el = effects->CL_AllocDlight( 0 );					el->origin = tr.endpos;					el->radius = 50; 					el->color.r = 200;					el->color.g = 200;					el->color.b = 200;					el->die = gpGlobals->curtime + 0.1;				}			}		}	}	else if ( m_pFlashlightBeam )	{		ReleaseFlashlight();	}}
开发者ID:uunx,项目名称:quakelife2,代码行数:93,



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


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