diff options
author | KittoFlora | 2009-11-16 01:40:15 +0100 |
---|---|---|
committer | KittoFlora | 2009-11-16 01:40:15 +0100 |
commit | 873c9098d8627972e80a1688e85a4cda45e1e7fe (patch) | |
tree | a0edc24aef11d5ad6928493d8985386f48dd2607 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Merge branch 'vehicles' into tests (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.zip opensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.tar.gz opensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.tar.bz2 opensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.tar.xz |
Merge branch 'careminster' into tests
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ab7abbe..ea4f2c7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -204,6 +204,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
204 | get { return m_parts.Count; } | 204 | get { return m_parts.Count; } |
205 | } | 205 | } |
206 | 206 | ||
207 | protected Quaternion m_rotation = Quaternion.Identity; | ||
208 | |||
209 | public virtual Quaternion Rotation | ||
210 | { | ||
211 | get { return m_rotation; } | ||
212 | set { m_rotation = value; } | ||
213 | } | ||
214 | |||
207 | public Quaternion GroupRotation | 215 | public Quaternion GroupRotation |
208 | { | 216 | { |
209 | get { return m_rootPart.RotationOffset; } | 217 | get { return m_rootPart.RotationOffset; } |
@@ -1015,9 +1023,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1015 | } | 1023 | } |
1016 | } | 1024 | } |
1017 | 1025 | ||
1018 | public float GetTimeDilation() | 1026 | public ushort GetTimeDilation() |
1019 | { | 1027 | { |
1020 | return m_scene.TimeDilation; | 1028 | return Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); |
1021 | } | 1029 | } |
1022 | 1030 | ||
1023 | /// <summary> | 1031 | /// <summary> |
@@ -1896,28 +1904,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1896 | { | 1904 | { |
1897 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1905 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); |
1898 | 1906 | ||
1899 | //if (IsAttachment) | 1907 | if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) |
1900 | //{ | ||
1901 | //foreach (SceneObjectPart part in m_parts.Values) | ||
1902 | //{ | ||
1903 | //part.SendScheduledUpdates(); | ||
1904 | //} | ||
1905 | //return; | ||
1906 | //} | ||
1907 | |||
1908 | if (UsePhysics && Util.DistanceLessThan(lastPhysGroupPos, AbsolutePosition, 0.02)) | ||
1909 | { | 1908 | { |
1910 | m_rootPart.UpdateFlag = 1; | 1909 | m_rootPart.UpdateFlag = 1; |
1911 | lastPhysGroupPos = AbsolutePosition; | 1910 | lastPhysGroupPos = AbsolutePosition; |
1912 | } | 1911 | } |
1913 | 1912 | ||
1914 | if (UsePhysics && ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) | 1913 | if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) |
1915 | || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) | ||
1916 | || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) | ||
1917 | || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))) | ||
1918 | { | 1914 | { |
1919 | m_rootPart.UpdateFlag = 1; | 1915 | m_rootPart.UpdateFlag = 1; |
1920 | |||
1921 | lastPhysGroupRot = GroupRotation; | 1916 | lastPhysGroupRot = GroupRotation; |
1922 | } | 1917 | } |
1923 | 1918 | ||
@@ -2011,12 +2006,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2011 | /// Note: this may not be cused by opensim (it probably should) but it's used by | 2006 | /// Note: this may not be cused by opensim (it probably should) but it's used by |
2012 | /// external modules. | 2007 | /// external modules. |
2013 | /// </summary> | 2008 | /// </summary> |
2014 | public void SendGroupRootUpdate() | 2009 | public void SendGroupRootTerseUpdate() |
2015 | { | 2010 | { |
2016 | if (IsDeleted) | 2011 | if (IsDeleted) |
2017 | return; | 2012 | return; |
2018 | 2013 | ||
2019 | RootPart.SendFullUpdateToAllClients(); | 2014 | RootPart.SendTerseUpdateToAllClients(); |
2020 | } | 2015 | } |
2021 | 2016 | ||
2022 | public void QueueForUpdateCheck() | 2017 | public void QueueForUpdateCheck() |
@@ -2998,12 +2993,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2998 | /// <param name="rot"></param> | 2993 | /// <param name="rot"></param> |
2999 | public void UpdateGroupRotationR(Quaternion rot) | 2994 | public void UpdateGroupRotationR(Quaternion rot) |
3000 | { | 2995 | { |
3001 | |||
3002 | m_rootPart.UpdateRotation(rot); | 2996 | m_rootPart.UpdateRotation(rot); |
3003 | if (m_rootPart.PhysActor != null) | 2997 | |
2998 | PhysicsActor actor = m_rootPart.PhysActor; | ||
2999 | if (actor != null) | ||
3004 | { | 3000 | { |
3005 | m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; | 3001 | actor.Orientation = m_rootPart.RotationOffset; |
3006 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 3002 | m_scene.PhysicsScene.AddPhysicsActorTaint(actor); |
3007 | } | 3003 | } |
3008 | 3004 | ||
3009 | HasGroupChanged = true; | 3005 | HasGroupChanged = true; |
@@ -3018,11 +3014,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3018 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) | 3014 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) |
3019 | { | 3015 | { |
3020 | m_rootPart.UpdateRotation(rot); | 3016 | m_rootPart.UpdateRotation(rot); |
3021 | if (m_rootPart.PhysActor != null) | 3017 | |
3018 | PhysicsActor actor = m_rootPart.PhysActor; | ||
3019 | if (actor != null) | ||
3022 | { | 3020 | { |
3023 | m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; | 3021 | actor.Orientation = m_rootPart.RotationOffset; |
3024 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 3022 | m_scene.PhysicsScene.AddPhysicsActorTaint(actor); |
3025 | } | 3023 | } |
3024 | |||
3026 | AbsolutePosition = pos; | 3025 | AbsolutePosition = pos; |
3027 | 3026 | ||
3028 | HasGroupChanged = true; | 3027 | HasGroupChanged = true; |