diff options
author | John Hurliman | 2009-09-16 15:45:40 -0700 |
---|---|---|
committer | John Hurliman | 2009-09-16 17:17:40 -0700 |
commit | 39842eb4af3b5a8c52d56c0f7f05ad54f0651bb0 (patch) | |
tree | 328265a2202540bc42941fcb87393d9534509a73 /OpenSim/Region | |
parent | SceneObjectGroup cleanup. Removes the default constructor and unnecessary nul... (diff) | |
download | opensim-SC_OLD-39842eb4af3b5a8c52d56c0f7f05ad54f0651bb0.zip opensim-SC_OLD-39842eb4af3b5a8c52d56c0f7f05ad54f0651bb0.tar.gz opensim-SC_OLD-39842eb4af3b5a8c52d56c0f7f05ad54f0651bb0.tar.bz2 opensim-SC_OLD-39842eb4af3b5a8c52d56c0f7f05ad54f0651bb0.tar.xz |
* Adding Scale to EntityBase * Fixing the incorrect initialization of EntityBase.Rotation * Removed SceneObjectGroup.GroupRotation and added overrides for Scale/Rotation/Velocity
Diffstat (limited to 'OpenSim/Region')
6 files changed, 46 insertions, 28 deletions
diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs index 3809749..66f4da0 100644 --- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
68 | 68 | ||
69 | public override void UpdateMovement() | 69 | public override void UpdateMovement() |
70 | { | 70 | { |
71 | UpdateGroupRotation(GroupRotation * m_rotationDirection); | 71 | UpdateGroupRotation(Rotation * m_rotationDirection); |
72 | 72 | ||
73 | base.UpdateMovement(); | 73 | base.UpdateMovement(); |
74 | } | 74 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs index 00c99c5..3ef4144 100644 --- a/OpenSim/Region/Framework/Scenes/EntityBase.cs +++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs | |||
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
94 | set { m_velocity = value; } | 94 | set { m_velocity = value; } |
95 | } | 95 | } |
96 | 96 | ||
97 | protected Quaternion m_rotation = new Quaternion(0f, 0f, 1f, 0f); | 97 | protected Quaternion m_rotation; |
98 | 98 | ||
99 | public virtual Quaternion Rotation | 99 | public virtual Quaternion Rotation |
100 | { | 100 | { |
@@ -102,6 +102,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
102 | set { m_rotation = value; } | 102 | set { m_rotation = value; } |
103 | } | 103 | } |
104 | 104 | ||
105 | protected Vector3 m_scale; | ||
106 | |||
107 | public virtual Vector3 Scale | ||
108 | { | ||
109 | get { return m_scale; } | ||
110 | set { m_scale = value; } | ||
111 | } | ||
112 | |||
105 | protected uint m_localId; | 113 | protected uint m_localId; |
106 | 114 | ||
107 | public virtual uint LocalId | 115 | public virtual uint LocalId |
@@ -115,13 +123,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
115 | /// </summary> | 123 | /// </summary> |
116 | public EntityBase() | 124 | public EntityBase() |
117 | { | 125 | { |
118 | m_uuid = UUID.Zero; | 126 | m_rotation = Quaternion.Identity; |
119 | 127 | m_scale = Vector3.One; | |
120 | m_pos = Vector3.Zero; | ||
121 | m_velocity = Vector3.Zero; | ||
122 | Rotation = Quaternion.Identity; | ||
123 | m_name = "(basic entity)"; | 128 | m_name = "(basic entity)"; |
124 | m_rotationalvelocity = Vector3.Zero; | ||
125 | } | 129 | } |
126 | 130 | ||
127 | /// <summary> | 131 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d8478a2..5b3062b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2296,8 +2296,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2296 | "to avatar {0} at position {1}", | 2296 | "to avatar {0} at position {1}", |
2297 | sp.UUID.ToString(), grp.AbsolutePosition); | 2297 | sp.UUID.ToString(), grp.AbsolutePosition); |
2298 | AttachObject(sp.ControllingClient, | 2298 | AttachObject(sp.ControllingClient, |
2299 | grp.LocalId, (uint)0, | 2299 | grp.LocalId, 0, |
2300 | grp.GroupRotation, | 2300 | grp.Rotation, |
2301 | grp.AbsolutePosition, false); | 2301 | grp.AbsolutePosition, false); |
2302 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2302 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2303 | grp.SendGroupFullUpdate(); | 2303 | grp.SendGroupFullUpdate(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3c17bbe..0cf08b5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -204,9 +204,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
204 | get { return m_parts.Count; } | 204 | get { return m_parts.Count; } |
205 | } | 205 | } |
206 | 206 | ||
207 | public Quaternion GroupRotation | 207 | public override Quaternion Rotation |
208 | { | 208 | { |
209 | get { return m_rootPart.RotationOffset; } | 209 | get { return m_rootPart.RotationOffset; } |
210 | set { m_rootPart.RotationOffset = value; } | ||
211 | } | ||
212 | |||
213 | public override Vector3 Scale | ||
214 | { | ||
215 | get { return m_rootPart.Scale; } | ||
216 | set { m_rootPart.Scale = value; } | ||
217 | } | ||
218 | |||
219 | public override Vector3 Velocity | ||
220 | { | ||
221 | get { return m_rootPart.Velocity; } | ||
222 | set { m_rootPart.Velocity = value; } | ||
210 | } | 223 | } |
211 | 224 | ||
212 | public UUID GroupID | 225 | public UUID GroupID |
@@ -523,7 +536,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
523 | // Temporary commented to stop compiler warning | 536 | // Temporary commented to stop compiler warning |
524 | //Vector3 partPosition = | 537 | //Vector3 partPosition = |
525 | // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); | 538 | // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); |
526 | Quaternion parentrotation = GroupRotation; | 539 | Quaternion parentrotation = Rotation; |
527 | 540 | ||
528 | // Telling the prim to raytrace. | 541 | // Telling the prim to raytrace. |
529 | //EntityIntersection inter = part.TestIntersection(hRay, parentrotation); | 542 | //EntityIntersection inter = part.TestIntersection(hRay, parentrotation); |
@@ -1866,14 +1879,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1866 | 1879 | ||
1867 | checkAtTargets(); | 1880 | checkAtTargets(); |
1868 | 1881 | ||
1869 | if (UsePhysics && ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) | 1882 | Quaternion rot = Rotation; |
1870 | || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) | 1883 | |
1871 | || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) | 1884 | if (UsePhysics && |
1872 | || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))) | 1885 | ((Math.Abs(lastPhysGroupRot.W - rot.W) > 0.1f) |
1886 | || (Math.Abs(lastPhysGroupRot.X - rot.X) > 0.1f) | ||
1887 | || (Math.Abs(lastPhysGroupRot.Y - rot.Y) > 0.1f) | ||
1888 | || (Math.Abs(lastPhysGroupRot.Z - rot.Z) > 0.1f))) | ||
1873 | { | 1889 | { |
1874 | m_rootPart.UpdateFlag = 1; | 1890 | m_rootPart.UpdateFlag = 1; |
1875 | 1891 | ||
1876 | lastPhysGroupRot = GroupRotation; | 1892 | lastPhysGroupRot = rot; |
1877 | } | 1893 | } |
1878 | 1894 | ||
1879 | foreach (SceneObjectPart part in m_parts.Values) | 1895 | 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 ba42678..39f620b 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 | |||
2004 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | 2004 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate |
2005 | } | 2005 | } |
2006 | else | 2006 | else |
2007 | q = part.ParentGroup.GroupRotation; // Likely never get here but just in case | 2007 | q = part.ParentGroup.Rotation; // Likely never get here but just in case |
2008 | } | 2008 | } |
2009 | else | 2009 | else |
2010 | q = part.ParentGroup.GroupRotation; // just the group rotation | 2010 | q = part.ParentGroup.Rotation; // just the group rotation |
2011 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 2011 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
2012 | } | 2012 | } |
2013 | q = part.GetWorldRotation(); | 2013 | q = part.GetWorldRotation(); |
@@ -7171,10 +7171,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7171 | else | 7171 | else |
7172 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | 7172 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate |
7173 | else | 7173 | else |
7174 | q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case | 7174 | q = m_host.ParentGroup.Rotation; // Likely never get here but just in case |
7175 | } | 7175 | } |
7176 | else | 7176 | else |
7177 | q = m_host.ParentGroup.GroupRotation; // just the group rotation | 7177 | q = m_host.ParentGroup.Rotation; // just the group rotation |
7178 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 7178 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
7179 | } | 7179 | } |
7180 | 7180 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index 4855d64..84ccafe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs | |||
@@ -218,16 +218,14 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | Position = new LSL_Types.Vector3(part.AbsolutePosition.X, | 221 | Vector3 absPos = part.AbsolutePosition; |
222 | part.AbsolutePosition.Y, | 222 | Position = new LSL_Types.Vector3(absPos.X, absPos.Y, absPos.Z); |
223 | part.AbsolutePosition.Z); | ||
224 | 223 | ||
225 | Quaternion wr = part.ParentGroup.GroupRotation; | 224 | Quaternion wr = part.ParentGroup.Rotation; |
226 | Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W); | 225 | Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W); |
227 | 226 | ||
228 | Velocity = new LSL_Types.Vector3(part.Velocity.X, | 227 | Vector3 vel = part.Velocity; |
229 | part.Velocity.Y, | 228 | Velocity = new LSL_Types.Vector3(vel.X, vel.Y, vel.Z); |
230 | part.Velocity.Z); | ||
231 | } | 229 | } |
232 | } | 230 | } |
233 | 231 | ||