Skip to content

Commit

Permalink
Fix in-vehicle weapon firing pos when using player guns
Browse files Browse the repository at this point in the history
  • Loading branch information
fholger committed Sep 5, 2023
1 parent fef1c1e commit 567b07e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Sources/CryGame C++/Solution1/CryGame/XPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3140,14 +3140,17 @@ void CPlayer::GetFirePosAngles(Vec3d& firePos, Vec3d& fireAngles)
string vehicleWeaponName = m_pVehicle->GetWeaponName( m_stats.inVehicleState );
if(!vehicleWeaponName.empty() && vehicleWeaponName != m_pVehicle->m_sNoWeaponName)
m_pVehicle->GetFirePosAngles( firePos, fireAngles );
else if(IsMyPlayer()) // use vehicle camera position only for local player
firePos = m_pVehicle->GetCamPos();
else
firePos += Vec3(0.0f, 0.0f, -1.04f); // [kirill] UGLY FIX FOR THE INFLATABLE BOAT!
else if (!m_usesMotionControls)
{
if (IsMyPlayer()) // use vehicle camera position only for local player
firePos = m_pVehicle->GetCamPos();
else
firePos += Vec3(0.0f, 0.0f, -1.04f); // [kirill] UGLY FIX FOR THE INFLATABLE BOAT!
}
// firePos on the server was 0.6 meters less than the client
}
// if passenger - get camera position from vehicle, it's smoothed with some spring simulation
else if (m_stats.inVehicleState == PVS_PASSENGER)
else if (m_stats.inVehicleState == PVS_PASSENGER && !m_usesMotionControls)
{
if(IsMyPlayer()) // use vehicle camera position only for local player
firePos = m_pVehicle->GetCamPos();
Expand Down

0 comments on commit 567b07e

Please sign in to comment.