From ec2ebf2598028daf4ff2003a53be3ca40ffc8272 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 4 Nov 2009 16:08:10 -0800 Subject: [PATCH] Removing EntityBase.Rotation --- OpenSim/Region/Framework/Scenes/EntityBase.cs | 14 -------------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 8 ++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 +++++++- .../Shared/Api/Implementation/OSSL_Api.cs | 9 ++++++++- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs index c2ec6a5c6e..1c76c546e5 100644 --- a/OpenSim/Region/Framework/Scenes/EntityBase.cs +++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs @@ -94,14 +94,6 @@ namespace OpenSim.Region.Framework.Scenes set { m_velocity = value; } } - protected Quaternion m_rotation = new Quaternion(0f, 0f, 1f, 0f); - - public virtual Quaternion Rotation - { - get { return m_rotation; } - set { m_rotation = value; } - } - protected uint m_localId; public virtual uint LocalId @@ -115,13 +107,7 @@ namespace OpenSim.Region.Framework.Scenes /// public EntityBase() { - m_uuid = UUID.Zero; - - m_pos = Vector3.Zero; - m_velocity = Vector3.Zero; - Rotation = Quaternion.Identity; m_name = "(basic entity)"; - m_rotationalvelocity = Vector3.Zero; } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c65a665d8c..f93847262a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -204,6 +204,14 @@ namespace OpenSim.Region.Framework.Scenes get { return m_parts.Count; } } + protected Quaternion m_rotation = Quaternion.Identity; + + public virtual Quaternion Rotation + { + get { return m_rotation; } + set { m_rotation = value; } + } + public Quaternion GroupRotation { get { return m_rootPart.RotationOffset; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6c0d9f2a9b..b12eea9aaf 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -481,6 +481,12 @@ namespace OpenSim.Region.Framework.Scenes } } + public Quaternion Rotation + { + get { return m_bodyRot; } + set { m_bodyRot = value; } + } + /// /// If this is true, agent doesn't have a representation in this scene. /// this is an agent 'looking into' this scene from a nearby scene(region) @@ -2256,7 +2262,7 @@ namespace OpenSim.Region.Framework.Scenes m_perfMonMS = Environment.TickCount; - m_rotation = rotation; + Rotation = rotation; Vector3 direc = vec * rotation; direc.Normalize(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 52396b6b2d..f1ceb80ca6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -384,7 +384,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (World.Entities.ContainsKey(target)) { - World.Entities[target].Rotation = rotation; + EntityBase entity; + if (World.Entities.TryGetValue(target, out entity)) + { + if (entity is SceneObjectGroup) + ((SceneObjectGroup)entity).Rotation = rotation; + else if (entity is ScenePresence) + ((ScenePresence)entity).Rotation = rotation; + } } else {