From 8c46ab02c7f289acf7544a7c270cae37958285bc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 21:11:39 +0100 Subject: [PATCH] move refresh forces into applyphysics --- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Framework/Scenes/SceneObjectGroup.cs | 25 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8f03a0ac7a..786258fb1c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments rootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.ApplyPhysics(); + so.ApplyPhysics(false); rootPart.Rezzed = DateTime.Now; so.AttachToBackup(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a52c0d64e0..d399535675 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1237,14 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } - ApplyPhysics(); - - if (RootPart.PhysActor != null) - RootPart.Force = RootPart.Force; - if (RootPart.PhysActor != null) - RootPart.Torque = RootPart.Torque; - if (RootPart.PhysActor != null) - RootPart.Buoyancy = RootPart.Buoyancy; + ApplyPhysics(true); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. @@ -1853,7 +1846,7 @@ namespace OpenSim.Region.Framework.Scenes AttachmentPoint = (byte)0; // must check if buildind should be true or false here // m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); - ApplyPhysics(); + ApplyPhysics(false); HasGroupChanged = true; RootPart.Rezzed = DateTime.Now; @@ -2158,7 +2151,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Apply physics to this group /// - public void ApplyPhysics() + public void ApplyPhysics(bool refreshForces) { SceneObjectPart[] parts = m_parts.GetArray(); if (parts.Length > 1) @@ -2177,16 +2170,22 @@ namespace OpenSim.Region.Framework.Scenes } // Hack to get the physics scene geometries in the right spot // ResetChildPrimPhysicsPositions(); + if (m_rootPart.PhysActor != null) - { m_rootPart.PhysActor.Building = false; - } } else { // Apply physics to the root prim m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); } + + if (m_rootPart.PhysActor != null && refreshForces) + { + m_rootPart.Force = m_rootPart.Force; + m_rootPart.Torque = m_rootPart.Torque; + m_rootPart.Buoyancy = m_rootPart.Buoyancy; + } } public void SetOwnerId(UUID userId) @@ -3080,7 +3079,7 @@ namespace OpenSim.Region.Framework.Scenes { // cancel physics RootPart.Flags &= ~PrimFlags.Physics; - ApplyPhysics(); + ApplyPhysics(false); } }