diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs index 3809749fa5..66f4da070a 100644 --- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.Examples.SimpleModule public override void UpdateMovement() { - UpdateGroupRotation(GroupRotation * m_rotationDirection); + UpdateGroupRotation(Rotation * m_rotationDirection); base.UpdateMovement(); } diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs index 00c99c5bbc..3ef41447fb 100644 --- a/OpenSim/Region/Framework/Scenes/EntityBase.cs +++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Scenes set { m_velocity = value; } } - protected Quaternion m_rotation = new Quaternion(0f, 0f, 1f, 0f); + protected Quaternion m_rotation; public virtual Quaternion Rotation { @@ -102,6 +102,14 @@ namespace OpenSim.Region.Framework.Scenes set { m_rotation = value; } } + protected Vector3 m_scale; + + public virtual Vector3 Scale + { + get { return m_scale; } + set { m_scale = value; } + } + protected uint m_localId; public virtual uint LocalId @@ -115,13 +123,9 @@ namespace OpenSim.Region.Framework.Scenes /// public EntityBase() { - m_uuid = UUID.Zero; - - m_pos = Vector3.Zero; - m_velocity = Vector3.Zero; - Rotation = Quaternion.Identity; + m_rotation = Quaternion.Identity; + m_scale = Vector3.One; m_name = "(basic entity)"; - m_rotationalvelocity = Vector3.Zero; } /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d8478a24f2..5b3062bfc8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2296,8 +2296,8 @@ namespace OpenSim.Region.Framework.Scenes "to avatar {0} at position {1}", sp.UUID.ToString(), grp.AbsolutePosition); AttachObject(sp.ControllingClient, - grp.LocalId, (uint)0, - grp.GroupRotation, + grp.LocalId, 0, + grp.Rotation, grp.AbsolutePosition, false); RootPrim.RemFlag(PrimFlags.TemporaryOnRez); grp.SendGroupFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3c17bbe9dd..0cf08b5682 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -204,9 +204,22 @@ namespace OpenSim.Region.Framework.Scenes get { return m_parts.Count; } } - public Quaternion GroupRotation + public override Quaternion Rotation { get { return m_rootPart.RotationOffset; } + set { m_rootPart.RotationOffset = value; } + } + + public override Vector3 Scale + { + get { return m_rootPart.Scale; } + set { m_rootPart.Scale = value; } + } + + public override Vector3 Velocity + { + get { return m_rootPart.Velocity; } + set { m_rootPart.Velocity = value; } } public UUID GroupID @@ -523,7 +536,7 @@ namespace OpenSim.Region.Framework.Scenes // Temporary commented to stop compiler warning //Vector3 partPosition = // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); - Quaternion parentrotation = GroupRotation; + Quaternion parentrotation = Rotation; // Telling the prim to raytrace. //EntityIntersection inter = part.TestIntersection(hRay, parentrotation); @@ -1866,14 +1879,17 @@ namespace OpenSim.Region.Framework.Scenes checkAtTargets(); - if (UsePhysics && ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) - || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) - || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) - || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))) + Quaternion rot = Rotation; + + if (UsePhysics && + ((Math.Abs(lastPhysGroupRot.W - rot.W) > 0.1f) + || (Math.Abs(lastPhysGroupRot.X - rot.X) > 0.1f) + || (Math.Abs(lastPhysGroupRot.Y - rot.Y) > 0.1f) + || (Math.Abs(lastPhysGroupRot.Z - rot.Z) > 0.1f))) { m_rootPart.UpdateFlag = 1; - lastPhysGroupRot = GroupRotation; + lastPhysGroupRot = rot; } foreach (SceneObjectPart part in m_parts.Values) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ba426782c8..39f620b185 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2004,10 +2004,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api q = avatar.Rotation; // Currently infrequently updated so may be inaccurate } else - q = part.ParentGroup.GroupRotation; // Likely never get here but just in case + q = part.ParentGroup.Rotation; // Likely never get here but just in case } else - q = part.ParentGroup.GroupRotation; // just the group rotation + q = part.ParentGroup.Rotation; // just the group rotation return new LSL_Rotation(q.X, q.Y, q.Z, q.W); } q = part.GetWorldRotation(); @@ -7171,10 +7171,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else q = avatar.Rotation; // Currently infrequently updated so may be inaccurate else - q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case + q = m_host.ParentGroup.Rotation; // Likely never get here but just in case } else - q = m_host.ParentGroup.GroupRotation; // just the group rotation + q = m_host.ParentGroup.Rotation; // just the group rotation return new LSL_Rotation(q.X, q.Y, q.Z, q.W); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index 4855d6448e..84ccafe3a9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs @@ -218,16 +218,14 @@ namespace OpenSim.Region.ScriptEngine.Shared } } - Position = new LSL_Types.Vector3(part.AbsolutePosition.X, - part.AbsolutePosition.Y, - part.AbsolutePosition.Z); + Vector3 absPos = part.AbsolutePosition; + Position = new LSL_Types.Vector3(absPos.X, absPos.Y, absPos.Z); - Quaternion wr = part.ParentGroup.GroupRotation; + Quaternion wr = part.ParentGroup.Rotation; Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W); - Velocity = new LSL_Types.Vector3(part.Velocity.X, - part.Velocity.Y, - part.Velocity.Z); + Vector3 vel = part.Velocity; + Velocity = new LSL_Types.Vector3(vel.X, vel.Y, vel.Z); } }