aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs27
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs22
4 files changed, 33 insertions, 39 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 31bd0b3..2fd4301 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -755,6 +755,7 @@ namespace OpenSim.Region.Environment.Scenes
755 group.AbsolutePosition = pos; 755 group.AbsolutePosition = pos;
756 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 756 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
757 rootPart.ApplySanePermissions(); 757 rootPart.ApplySanePermissions();
758 group.ApplyPhysics(m_physicalPrim);
758 //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); 759 //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim);
759 //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 760 //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
760 //{ 761 //{
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 43486e8..86f43b3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -908,17 +908,8 @@ namespace OpenSim.Region.Environment.Scenes
908 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 908 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
909 rootPart.ApplySanePermissions(); 909 rootPart.ApplySanePermissions();
910 910
911 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 911 group.ApplyPhysics(m_physicalPrim);
912 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 912 //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
913 rootPart.PhysActor = PhysicsScene.AddPrimShape(
914 rootPart.Name,
915 rootPart.Shape,
916 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
917 rootPart.AbsolutePosition.Z),
918 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
919 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
920 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
921 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
922 } 913 }
923 914
924 MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 915 MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
@@ -1054,19 +1045,7 @@ namespace OpenSim.Region.Environment.Scenes
1054 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 1045 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
1055 } 1046 }
1056 // if not phantom, add to physics 1047 // if not phantom, add to physics
1057 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 1048 sceneOb.ApplyPhysics(m_physicalPrim);
1058 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
1059 {
1060 rootPart.PhysActor =
1061 PhysicsScene.AddPrimShape(
1062 rootPart.Name,
1063 rootPart.Shape,
1064 new PhysicsVector(pos.X, pos.Y, pos.Z),
1065 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
1066 new Quaternion(), UsePhysics);
1067 // subscribe to physics events.
1068 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
1069 }
1070 } 1049 }
1071 1050
1072 public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position, 1051 public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position,
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index ffc72c9..b591802 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -249,7 +249,7 @@ namespace OpenSim.Region.Environment.Scenes
249 249
250 AttachToBackup(); 250 AttachToBackup();
251 251
252 ApplyPhysics(); 252 ApplyPhysics(scene.m_physicalPrim);
253 253
254 ScheduleGroupForFullUpdate(); 254 ScheduleGroupForFullUpdate();
255 } 255 }
@@ -302,7 +302,7 @@ namespace OpenSim.Region.Environment.Scenes
302 302
303 AttachToBackup(); 303 AttachToBackup();
304 304
305 ApplyPhysics(); 305 ApplyPhysics(scene.m_physicalPrim);
306 306
307 ScheduleGroupForFullUpdate(); 307 ScheduleGroupForFullUpdate();
308 } 308 }
@@ -426,7 +426,7 @@ namespace OpenSim.Region.Environment.Scenes
426 426
427 AttachToBackup(); 427 AttachToBackup();
428 428
429 ApplyPhysics(); 429 //ApplyPhysics(scene.m_physicalPrim);
430 } 430 }
431 431
432 /// <summary> 432 /// <summary>
@@ -1577,6 +1577,12 @@ namespace OpenSim.Region.Environment.Scenes
1577 } 1577 }
1578 } 1578 }
1579 1579
1580 public void ResetChildPrimPhysicsPositions()
1581 {
1582 AbsolutePosition = AbsolutePosition;
1583 HasChanged = false;
1584 }
1585
1580 public LLUUID GetPartsFullID(uint localID) 1586 public LLUUID GetPartsFullID(uint localID)
1581 { 1587 {
1582 SceneObjectPart part = GetChildPart(localID); 1588 SceneObjectPart part = GetChildPart(localID);
@@ -1649,18 +1655,22 @@ namespace OpenSim.Region.Environment.Scenes
1649 Text = text; 1655 Text = text;
1650 } 1656 }
1651 1657
1652 public void ApplyPhysics() 1658 public void ApplyPhysics(bool m_physicalPrim)
1653 { 1659 {
1654 if (m_parts.Count > 1) 1660 if (m_parts.Count > 1)
1655 { 1661 {
1656 foreach (SceneObjectPart parts in m_parts.Values) 1662 foreach (SceneObjectPart parts in m_parts.Values)
1657 { 1663 {
1658 parts.ApplyPhysics(); 1664 parts.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim);
1665
1666 // Hack to get the physics scene geometries in the right spot
1667 ResetChildPrimPhysicsPositions();
1668
1659 } 1669 }
1660 } 1670 }
1661 else 1671 else
1662 { 1672 {
1663 m_rootPart.ApplyPhysics(); 1673 m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim);
1664 } 1674 }
1665 } 1675 }
1666 } 1676 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index f2594a9..468e2d0 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.Environment.Scenes
261 try 261 try
262 { 262 {
263 // Hack to get the child prim to update positions in the physics engine 263 // Hack to get the child prim to update positions in the physics engine
264 ParentGroup.AbsolutePosition = ParentGroup.AbsolutePosition; 264 ParentGroup.ResetChildPrimPhysicsPositions();
265 } 265 }
266 catch (System.NullReferenceException) 266 catch (System.NullReferenceException)
267 { 267 {
@@ -646,14 +646,17 @@ namespace OpenSim.Region.Environment.Scenes
646 return newobject; 646 return newobject;
647 } 647 }
648 648
649 public void ApplyPhysics() 649 public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim)
650 { 650 {
651 bool isPhysical = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
652 bool isPhantom = ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0);
653 651
654 bool usePhysics = isPhysical && !isPhantom; 652 bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim);
653 bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0);
655 654
656 if (usePhysics) 655 // Added clarification.. since A rigid body is an object that you can kick around, etc.
656 bool RigidBody = isPhysical && !isPhantom;
657
658 // The only time the physics scene shouldn't know about the prim is if it's phantom
659 if (!isPhantom)
657 { 660 {
658 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 661 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
659 Name, 662 Name,
@@ -662,10 +665,11 @@ namespace OpenSim.Region.Environment.Scenes
662 AbsolutePosition.Z), 665 AbsolutePosition.Z),
663 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 666 new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
664 new Quaternion(RotationOffset.W, RotationOffset.X, 667 new Quaternion(RotationOffset.W, RotationOffset.X,
665 RotationOffset.Y, RotationOffset.Z), usePhysics); 668 RotationOffset.Y, RotationOffset.Z), RigidBody);
666 }
667 669
668 DoPhysicsPropertyUpdate(usePhysics, true); 670
671 DoPhysicsPropertyUpdate(RigidBody, true);
672 }
669 } 673 }
670 674
671 public void ApplyNextOwnerPermissions() 675 public void ApplyNextOwnerPermissions()