Skip to content

Commit c118bf6

Browse files
authored
Move quat normalization after dropping checks
1 parent 5f5a646 commit c118bf6

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

Server/Source/player_pool.hpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,19 +1563,6 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
15631563
return false;
15641564
}
15651565

1566-
float magnitude = glm::length(trailerSync.Quat);
1567-
if (std::abs(1.0f - magnitude) >= 0.000001f)
1568-
{
1569-
if (magnitude < 0.1f)
1570-
{
1571-
trailerSync.Quat = glm::vec4(0.5f);
1572-
}
1573-
else
1574-
{
1575-
trailerSync.Quat /= magnitude;
1576-
}
1577-
}
1578-
15791566
IVehicle* vehiclePtr = self.vehiclesComponent->get(trailerSync.VehicleID);
15801567
if (!vehiclePtr)
15811568
{
@@ -1598,6 +1585,20 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
15981585
return false;
15991586
}
16001587

1588+
// Normalise quaternions
1589+
float magnitude = glm::length(trailerSync.Quat);
1590+
if (std::abs(1.0f - magnitude) >= 0.000001f)
1591+
{
1592+
if (magnitude < 0.1f)
1593+
{
1594+
trailerSync.Quat = glm::vec4(0.5f);
1595+
}
1596+
else
1597+
{
1598+
trailerSync.Quat /= magnitude;
1599+
}
1600+
}
1601+
16011602
if (vehicle.updateFromTrailerSync(trailerSync, peer))
16021603
{
16031604
trailerSync.PlayerID = player.poolID;

0 commit comments

Comments
 (0)