aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-14 18:29:04 +0000
committerTeravus Ovares2008-01-14 18:29:04 +0000
commita522d7844b44534136475c5f45dd8608ee37ef1f (patch)
tree325df5653e84d9d625fd10a6a0798cb83782995e
parentPrint out the exception as well as APPLICATION EXCEPTION DETECTED when the se... (diff)
downloadopensim-SC_OLD-a522d7844b44534136475c5f45dd8608ee37ef1f.zip
opensim-SC_OLD-a522d7844b44534136475c5f45dd8608ee37ef1f.tar.gz
opensim-SC_OLD-a522d7844b44534136475c5f45dd8608ee37ef1f.tar.bz2
opensim-SC_OLD-a522d7844b44534136475c5f45dd8608ee37ef1f.tar.xz
* First pass at collidable linksets
* There will be bugs, you can count on that. To avoid them, set the linksets phantom * After region restart, the linksets restore in a non collidable state. * Linksets can but shouldn't be made physical with the physical checkbox or when you unlink them, they tend to explode. * After creating a linkset, you have to move the linkset or set it phantom and not phantom for it to become collidable. * There's a few ParentGroup references that need to be refactored.
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs80
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs110
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs4
4 files changed, 154 insertions, 41 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 8c0ba3c..0116428 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -170,6 +170,7 @@ namespace OpenSim.Region.Environment.Scenes
170 foreach (SceneObjectPart part in sceneObject.Children.Values) 170 foreach (SceneObjectPart part in sceneObject.Children.Values)
171 { 171 {
172 part.LocalID = m_parentScene.PrimIDAllocate(); 172 part.LocalID = m_parentScene.PrimIDAllocate();
173
173 } 174 }
174 sceneObject.UpdateParentIDs(); 175 sceneObject.UpdateParentIDs();
175 AddEntity(sceneObject); 176 AddEntity(sceneObject);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index cd8b8e4..879e4a3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -146,13 +146,13 @@ namespace OpenSim.Region.Environment.Scenes
146 part.GroupPosition = val; 146 part.GroupPosition = val;
147 } 147 }
148 } 148 }
149 if (m_rootPart.PhysActor != null) 149 //if (m_rootPart.PhysActor != null)
150 { 150 //{
151 m_rootPart.PhysActor.Position = 151 //m_rootPart.PhysActor.Position =
152 new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, 152 //new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y,
153 m_rootPart.GroupPosition.Z); 153 //m_rootPart.GroupPosition.Z);
154 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 154 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
155 } 155 //}
156 } 156 }
157 } 157 }
158 158
@@ -844,7 +844,7 @@ namespace OpenSim.Region.Environment.Scenes
844 } 844 }
845 return false; 845 return false;
846 } 846 }
847 847
848 #endregion 848 #endregion
849 849
850 #region Packet Handlers 850 #region Packet Handlers
@@ -881,12 +881,12 @@ namespace OpenSim.Region.Environment.Scenes
881 m_parts.Add(linkPart.UUID, linkPart); 881 m_parts.Add(linkPart.UUID, linkPart);
882 linkPart.SetParent(this); 882 linkPart.SetParent(this);
883 883
884 if (linkPart.PhysActor != null) 884 //if (linkPart.PhysActor != null)
885 { 885 //{
886 m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); 886 // m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
887 887
888 linkPart.PhysActor = null; 888 //linkPart.PhysActor = null;
889 } 889 //}
890 890
891 //TODO: rest of parts 891 //TODO: rest of parts
892 foreach (SceneObjectPart part in objectGroup.Children.Values) 892 foreach (SceneObjectPart part in objectGroup.Children.Values)
@@ -902,6 +902,7 @@ namespace OpenSim.Region.Environment.Scenes
902 m_scene.DeleteEntity(objectGroup.UUID); 902 m_scene.DeleteEntity(objectGroup.UUID);
903 903
904 objectGroup.DeleteParts(); 904 objectGroup.DeleteParts();
905 AbsolutePosition = AbsolutePosition;
905 ScheduleGroupForFullUpdate(); 906 ScheduleGroupForFullUpdate();
906 } 907 }
907 908
@@ -918,7 +919,7 @@ namespace OpenSim.Region.Environment.Scenes
918 { 919 {
919 // Remove the part from this object 920 // Remove the part from this object
920 m_parts.Remove(linkPart.UUID); 921 m_parts.Remove(linkPart.UUID);
921 922 linkPart.ParentID = 0;
922 // We need to reset the child part's position 923 // We need to reset the child part's position
923 // ready for life as a separate object after being a part of another object 924 // ready for life as a separate object after being a part of another object
924 Quaternion parentRot 925 Quaternion parentRot
@@ -951,19 +952,19 @@ namespace OpenSim.Region.Environment.Scenes
951 // Add physics information back to delinked part if appropriate 952 // Add physics information back to delinked part if appropriate
952 // XXX This is messy and should be refactorable with the similar section in 953 // XXX This is messy and should be refactorable with the similar section in
953 // SceneObjectPart.UpdatePrimFlags() 954 // SceneObjectPart.UpdatePrimFlags()
954 if (m_rootPart.PhysActor != null) 955 //if (m_rootPart.PhysActor != null)
955 { 956 //{
956 linkPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( 957 //linkPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
957 linkPart.Name, 958 //linkPart.Name,
958 linkPart.Shape, 959 //linkPart.Shape,
959 new PhysicsVector(linkPart.AbsolutePosition.X, linkPart.AbsolutePosition.Y, 960 //new PhysicsVector(linkPart.AbsolutePosition.X, linkPart.AbsolutePosition.Y,
960 linkPart.AbsolutePosition.Z), 961 //linkPart.AbsolutePosition.Z),
961 new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z), 962 //new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z),
962 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, 963 //new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X,
963 linkPart.RotationOffset.Y, linkPart.RotationOffset.Z), 964 //linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
964 m_rootPart.PhysActor.IsPhysical); 965 //m_rootPart.PhysActor.IsPhysical);
965 m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true); 966 //m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
966 } 967 //}
967 968
968 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart); 969 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart);
969 970
@@ -1139,7 +1140,18 @@ namespace OpenSim.Region.Environment.Scenes
1139 SceneObjectPart part = GetChildPart(localID); 1140 SceneObjectPart part = GetChildPart(localID);
1140 if (part != null) 1141 if (part != null)
1141 { 1142 {
1142 part.UpdatePrimFlags(type, inUse, data); 1143 // If we have children
1144 if (m_parts.Count > 1)
1145 {
1146 foreach (SceneObjectPart parts in m_parts.Values)
1147 {
1148 parts.UpdatePrimFlags(type, inUse, data);
1149 }
1150 }
1151 else
1152 {
1153 part.UpdatePrimFlags(type, inUse, data);
1154 }
1143 } 1155 }
1144 } 1156 }
1145 1157
@@ -1639,7 +1651,17 @@ namespace OpenSim.Region.Environment.Scenes
1639 1651
1640 public void ApplyPhysics() 1652 public void ApplyPhysics()
1641 { 1653 {
1642 m_rootPart.ApplyPhysics(); 1654 if (m_parts.Count > 1)
1655 {
1656 foreach (SceneObjectPart parts in m_parts.Values)
1657 {
1658 parts.ApplyPhysics();
1659 }
1660 }
1661 else
1662 {
1663 m_rootPart.ApplyPhysics();
1664 }
1643 } 1665 }
1644 } 1666 }
1645} 1667}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 5a02ad4..4456182 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -153,12 +153,65 @@ namespace OpenSim.Region.Environment.Scenes
153 //unkown if this will be kept, added as a way of removing the group position from the group class 153 //unkown if this will be kept, added as a way of removing the group position from the group class
154 protected LLVector3 m_groupPosition; 154 protected LLVector3 m_groupPosition;
155 155
156 public LLVector3 GetWorldPosition()
157 {
158
159 Quaternion parentRot = new Quaternion(
160 ParentGroup.RootPart.RotationOffset.W,
161 ParentGroup.RootPart.RotationOffset.X,
162 ParentGroup.RootPart.RotationOffset.Y,
163 ParentGroup.RootPart.RotationOffset.Z);
164
165 Vector3 axPos
166 = new Vector3(
167 OffsetPosition.X,
168 OffsetPosition.Y,
169 OffsetPosition.Z);
170
171 axPos = parentRot * axPos;
172 LLVector3 translationOffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
173 return GroupPosition + translationOffsetPosition;
174
175 //return (new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z) + AbsolutePosition);
176 }
177
178 public LLQuaternion GetWorldRotation()
179 {
180 Quaternion newRot;
181
182 if (this.LinkNum == 0)
183 {
184 newRot = new Quaternion(RotationOffset.W,RotationOffset.X,RotationOffset.Y,RotationOffset.Z);
185
186 }
187 else
188 {
189 Quaternion parentRot = new Quaternion(
190 ParentGroup.RootPart.RotationOffset.W,
191 ParentGroup.RootPart.RotationOffset.X,
192 ParentGroup.RootPart.RotationOffset.Y,
193 ParentGroup.RootPart.RotationOffset.Z);
194
195 Quaternion oldRot
196 = new Quaternion(
197 RotationOffset.W,
198 RotationOffset.X,
199 RotationOffset.Y,
200 RotationOffset.Z);
201
202 newRot = parentRot * oldRot;
203 }
204 return new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
205
206 //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
207
208 }
156 209
157 public LLVector3 GroupPosition 210 public LLVector3 GroupPosition
158 { 211 {
159 get 212 get
160 { 213 {
161 if (PhysActor != null) 214 if (PhysActor != null && ParentID == 0)
162 { 215 {
163 m_groupPosition.X = PhysActor.Position.X; 216 m_groupPosition.X = PhysActor.Position.X;
164 m_groupPosition.Y = PhysActor.Position.Y; 217 m_groupPosition.Y = PhysActor.Position.Y;
@@ -167,23 +220,35 @@ namespace OpenSim.Region.Environment.Scenes
167 return m_groupPosition; 220 return m_groupPosition;
168 } 221 }
169 set 222 set
170 { 223 {
224 m_groupPosition = value;
225
171 if (PhysActor != null) 226 if (PhysActor != null)
172 { 227 {
173 try 228 try
174 { 229 {
175 //lock (m_parentGroup.Scene.SyncRoot) 230
176 //{ 231 if (ParentID == 0)
177 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); 232 {
233 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
234
235 }
236 else
237 {
238 LLVector3 resultingposition = GetWorldPosition();
239 PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
240 LLQuaternion resultingrot = GetWorldRotation();
241 PhysActor.Orientation = new Quaternion(resultingrot.W, resultingrot.X, resultingrot.Y, resultingrot.Z);
242 }
243
178 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 244 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
179 //}
180 } 245 }
181 catch (Exception e) 246 catch (Exception e)
182 { 247 {
183 Console.WriteLine(e.Message); 248 Console.WriteLine(e.Message);
184 } 249 }
185 } 250 }
186 m_groupPosition = value; 251
187 } 252 }
188 } 253 }
189 254
@@ -192,7 +257,18 @@ namespace OpenSim.Region.Environment.Scenes
192 public LLVector3 OffsetPosition 257 public LLVector3 OffsetPosition
193 { 258 {
194 get { return m_offsetPosition; } 259 get { return m_offsetPosition; }
195 set { m_offsetPosition = value; } 260 set { m_offsetPosition = value;
261 try
262 {
263 // Hack to get the child prim to update positions in the physics engine
264 ParentGroup.AbsolutePosition = ParentGroup.AbsolutePosition;
265 }
266 catch (System.NullReferenceException)
267 {
268 // Ignore, and skip over.
269 }
270 //MainLog.Instance.Verbose("PART", "OFFSET:" + m_offsetPosition, ToString());
271 }
196 } 272 }
197 273
198 public LLVector3 AbsolutePosition 274 public LLVector3 AbsolutePosition
@@ -206,7 +282,7 @@ namespace OpenSim.Region.Environment.Scenes
206 { 282 {
207 get 283 get
208 { 284 {
209 if (PhysActor != null) 285 if (PhysActor != null && ParentID == 0)
210 { 286 {
211 if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0 287 if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0
212 || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0) 288 || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0)
@@ -221,13 +297,25 @@ namespace OpenSim.Region.Environment.Scenes
221 } 297 }
222 set 298 set
223 { 299 {
300 m_rotationOffset = value;
301
224 if (PhysActor != null) 302 if (PhysActor != null)
225 { 303 {
226 try 304 try
227 { 305 {
228 //lock (Scene.SyncRoot) 306 //lock (Scene.SyncRoot)
229 //{ 307 //{
230 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z); 308 if (ParentID == 0)
309 {
310 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z);
311 //MainLog.Instance.Verbose("PART", "RO1:" + PhysActor.Orientation.ToString());
312 }
313 else
314 {
315 LLQuaternion resultingrotation = GetWorldRotation();
316 PhysActor.Orientation = new Quaternion(resultingrotation.W, resultingrotation.X, resultingrotation.Y, resultingrotation.Z);
317 //MainLog.Instance.Verbose("PART", "RO2:" + PhysActor.Orientation.ToString());
318 }
231 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 319 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
232 //} 320 //}
233 } 321 }
@@ -236,7 +324,7 @@ namespace OpenSim.Region.Environment.Scenes
236 Console.WriteLine(ex.Message); 324 Console.WriteLine(ex.Message);
237 } 325 }
238 } 326 }
239 m_rotationOffset = value; 327
240 } 328 }
241 } 329 }
242 330
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 5fef47d..6d08f98 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -587,7 +587,9 @@ namespace OpenSim.Region.Physics.OdePlugin
587 { 587 {
588 get { return _position; } 588 get { return _position; }
589 589
590 set { _position = value; } 590 set { _position = value;
591 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", _position.ToString());
592 }
591 } 593 }
592 594
593 public override PhysicsVector Size 595 public override PhysicsVector Size