From 6bac44e767819b6aa82d0ed503c5bcc7f72b9883 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 29 Jun 2017 00:42:35 +0100 Subject: [PATCH] bug fix --- .../ClientStack/Linden/UDP/LLClientView.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b3e68ec282..53c185b03a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5526,6 +5526,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion #region Helper Methods + private void ClampVectorForUint(ref Vector3 v, float max) + { + float a,b; + + a = Math.Abs(v.X); + b = Math.Abs(v.Y); + if(b > a) + a = b; + b= Math.Abs(v.Z); + if(b > a) + a = b; + + if (a > max) + { + a = max / a; + v.X *= a; + v.Y *= a; + v.Z *= a; + } + } protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity, bool sendTexture) { @@ -5616,11 +5636,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP pos += 12; // Velocity + ClampVectorForUint(ref velocity, 128f); Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.X, -128.0f, 128.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Y, -128.0f, 128.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Z, -128.0f, 128.0f), data, pos); pos += 2; // Acceleration + ClampVectorForUint(ref acceleration, 64f); Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.X, -64.0f, 64.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Y, -64.0f, 64.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Z, -64.0f, 64.0f), data, pos); pos += 2; @@ -5632,6 +5654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.UInt16ToBytes(Utils.FloatToUInt16(rotation.W, -1.0f, 1.0f), data, pos); pos += 2; // Angular Velocity + ClampVectorForUint(ref angularVelocity, 64f); Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.X, -64.0f, 64.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2;