Exemplo n.º 1
0
void CPlayerRotation::ProcessNormal( float frameTime )
{
#ifdef ENABLE_NAN_CHECK
	//create a matrix perpendicular to the ground
	Vec3 up(0,0,1);
	//..or perpendicular to the linked object Z
	SLinkStats *pLinkStats = &m_player.m_linkStats;
	if (pLinkStats->linkID && pLinkStats->flags & SLinkStats::LINKED_FREELOOK)
	{
		IEntity *pLinked = pLinkStats->GetLinked();
		if (pLinked)
			up = pLinked->GetRotation().GetColumn2();
	}
	
	const Vec3 right(m_baseQuat.GetColumn0());
	const Vec3 forward((up % right).GetNormalized());

	PR_CHECKQNAN_VEC(up);
	PR_CHECKQNAN_VEC(right);
#endif //ENABLE_NAN_CHECK

	const Ang3 vNewDeltaAngles = m_deltaAngles * m_player.m_stats.flashBangStunMult;

#ifdef PLAYER_MOVEMENT_DEBUG_ENABLED
	m_player.DebugGraph_AddValue("AimDeltaH", vNewDeltaAngles.z);
	m_player.DebugGraph_AddValue("AimDeltaV", vNewDeltaAngles.x);
#endif

	Ang3 newViewAngles;
	newViewAngles.Set(m_viewAngles.x + vNewDeltaAngles.x, m_viewAngles.y, m_viewAngles.z + vNewDeltaAngles.z);
	newViewAngles += m_externalAngles;

	//These values need to be used because the player rotation is a quat and quaternions wrap on 720 degrees
	newViewAngles.z = (float)__fsel(  newViewAngles.z - (2.0f * gf_PI2),  newViewAngles.z - (4.0f * gf_PI2), newViewAngles.z);
	newViewAngles.z = (float)__fsel(-(newViewAngles.z + (2.0f * gf_PI2)), newViewAngles.z + (4.0f * gf_PI2), newViewAngles.z);
	
	m_viewAngles = newViewAngles;
		
	if (m_player.CanTurnBody())
	{
		m_baseQuat = Quat::CreateRotationZ(newViewAngles.z);
	}
	
	newViewAngles.y += m_viewRoll;
	m_viewQuat.SetRotationXYZ(newViewAngles);
	
	m_deltaAngles = vNewDeltaAngles;

	if(!m_player.GetLinkedVehicle())
	{
		CHANGED_NETWORK_STATE_REF(m_player, CPlayer::ASPECT_INPUT_CLIENT);
	}
}
Exemplo n.º 2
0
void VrInput::weaponOrientation(Ang3 &angle)
{
	// Reorienting to engine standards for angles
	angle.Set(DEG2RAD(-_weaponAngle.z), DEG2RAD(-_weaponAngle.x), DEG2RAD(_weaponAngle.y));
}
Exemplo n.º 3
0
void VrInput::headOrientation(Ang3 &angle)
{
	angle.Set(DEG2RAD(-_headAngle.x), DEG2RAD(_headAngle.z), DEG2RAD(_headAngle.y));
}