Пример #1
0
void UpdateAvatarEffect(void)
{
	if(!haptics->HasDevice())
		return;

	Vector vel;
	Vector vvel;
	Vector evel;
	QAngle eye;
	C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
	if(!pPlayer)
		return;

	eye = pPlayer->GetAbsAngles();

	if(pPlayer->IsInAVehicle() && pPlayer->GetVehicle())
	{
		pPlayer->GetVehicle()->GetVehicleEnt()->EstimateAbsVelocity(vvel);
		eye = pPlayer->GetVehicle()->GetVehicleEnt()->EyeAngles();

		if(!Q_stristr(pPlayer->GetVehicle()->GetVehicleEnt()->GetClassname(),"choreo"))
		{
			eye[YAW] += 90;
		}
		


	}
	else
	{
		vel = pPlayer->GetAbsVelocity();
	}

	Vector PlayerVel = pPlayer->GetAbsVelocity();

	//Choreo vehicles use player avatar and don't produce their own velocity
	if(!pPlayer->GetVehicle() || abs(vvel.Length()) == 0 )
	{
		vel = PlayerVel;
	}
	else
		vel = vvel;


	
	VectorYawRotate(vel, -90 -eye[YAW], vel );

	vel.y = -vel.y;
	vel.z = -vel.z;
	
	switch(pPlayer->GetMoveType()) {
		case MOVETYPE_NOCLIP:
			vel *= hap_noclip_avatar_scale.GetFloat();
			break;
		default:
			break;
	}

	haptics->UpdateAvatarVelocity(vel);
}
Пример #2
0
void CMoveHelperClient::ProcessImpacts( void )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	// Relink in order to build absorigin and absmin/max to reflect any changes
	//  from prediction.  Relink will early out on SOLID_NOT

	// TODO: Touch triggers on the client
	//pPlayer->PhysicsTouchTriggers();

	// Don't bother if the player ain't solid
	if ( pPlayer->IsSolidFlagSet( FSOLID_NOT_SOLID ) )
		return;

	// Save off the velocity, cause we need to temporarily reset it
	Vector vel = pPlayer->GetAbsVelocity();

	// Touch other objects that were intersected during the movement.
	for (int i = 0 ; i < m_TouchList.Size(); i++)
	{
		// Run the impact function as if we had run it during movement.
		C_BaseEntity *entity = ClientEntityList().GetEnt( m_TouchList[i].trace.m_pEnt->entindex() );
		if ( !entity )
			continue;

		Assert( entity != pPlayer );
		// Don't ever collide with self!!!!
		if ( entity == pPlayer )
			continue;

		// Reconstruct trace results.
		m_TouchList[i].trace.m_pEnt = entity;

		// Use the velocity we had when we collided, so boxes will move, etc.
		pPlayer->SetAbsVelocity( m_TouchList[i].deltavelocity );

		entity->PhysicsImpact( pPlayer, m_TouchList[i].trace );
	}

	// Restore the velocity
	pPlayer->SetAbsVelocity( vel );

	// So no stuff is ever left over, sigh...
	ResetTouchList();
}