aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs23
3 files changed, 53 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 77658ef..719a5dd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -5037,20 +5037,22 @@ namespace OpenSim.Region.Framework.Scenes
5037 5037
5038 public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux ) 5038 public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux )
5039 { 5039 {
5040 PhysicsActor pa = RootPart.PhysActor; 5040 PhysicsInertiaData inertia = new PhysicsInertiaData();
5041 inertia.TotalMass = TotalMass;
5042 inertia.CenterOfMass = CenterOfMass;
5043 inertia.Inertia = Inertia;
5044 inertia.InertiaRotation = aux;
5045
5046 if(TotalMass < 0)
5047 RootPart.PhysicsInertia = null;
5048 else
5049 RootPart.PhysicsInertia = new PhysicsInertiaData(inertia);
5041 5050
5051 PhysicsActor pa = RootPart.PhysActor;
5042 if(pa !=null) 5052 if(pa !=null)
5043 {
5044 PhysicsInertiaData inertia = new PhysicsInertiaData();
5045 inertia.TotalMass = TotalMass;
5046 inertia.CenterOfMass = CenterOfMass;
5047 inertia.Inertia = Inertia;
5048 inertia.InertiaRotation = aux;
5049 pa.SetInertiaData(inertia); 5053 pa.SetInertiaData(inertia);
5050 }
5051 } 5054 }
5052 5055
5053
5054 /// <summary> 5056 /// <summary>
5055 /// Set the user group to which this scene object belongs. 5057 /// Set the user group to which this scene object belongs.
5056 /// </summary> 5058 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index bf0e31b..46b7b86 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -406,6 +406,8 @@ namespace OpenSim.Region.Framework.Scenes
406 406
407 private SOPVehicle m_vehicleParams = null; 407 private SOPVehicle m_vehicleParams = null;
408 408
409 private PhysicsInertiaData m_physicsInertia;
410
409 public KeyframeMotion KeyframeMotion 411 public KeyframeMotion KeyframeMotion
410 { 412 {
411 get; set; 413 get; set;
@@ -3548,6 +3550,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
3548 Force = force; 3550 Force = force;
3549 } 3551 }
3550 3552
3553 public PhysicsInertiaData PhysicsInertia
3554 {
3555 get
3556 {
3557 return m_physicsInertia;
3558 }
3559 set
3560 {
3561 m_physicsInertia = value;
3562 }
3563 }
3564
3551 public SOPVehicle VehicleParams 3565 public SOPVehicle VehicleParams
3552 { 3566 {
3553 get 3567 get
@@ -4748,8 +4762,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4748 4762
4749 if (VolumeDetectActive) // change if not the default only 4763 if (VolumeDetectActive) // change if not the default only
4750 pa.SetVolumeDetect(1); 4764 pa.SetVolumeDetect(1);
4765
4766 bool isroot = (m_localId == ParentGroup.RootPart.LocalId);
4767
4768 if(isroot && m_physicsInertia != null)
4769 pa.SetInertiaData(m_physicsInertia);
4751 4770
4752 if (m_vehicleParams != null && m_localId == ParentGroup.RootPart.LocalId) 4771 if (isroot && m_vehicleParams != null )
4753 { 4772 {
4754 m_vehicleParams.SetVehicle(pa); 4773 m_vehicleParams.SetVehicle(pa);
4755 if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled) 4774 if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index a12a401..87d1ace 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -453,9 +453,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
453 m_SOPXmlProcessors.Add("Torque", ProcessTorque); 453 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
454 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); 454 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
455 455
456
457 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle); 456 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
458 457
458 m_SOPXmlProcessors.Add("PhysicsInertia", ProcessPhysicsInertia);
459
459 m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks); 460 m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks);
460 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); 461 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
461 m_SOPXmlProcessors.Add("Density", ProcessDensity); 462 m_SOPXmlProcessors.Add("Density", ProcessDensity);
@@ -781,6 +782,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
781 } 782 }
782 } 783 }
783 784
785 private static void ProcessPhysicsInertia(SceneObjectPart obj, XmlReader reader)
786 {
787 PhysicsInertiaData pdata = PhysicsInertiaData.FromXml2(reader);
788
789 if (pdata == null)
790 {
791 obj.PhysicsInertia = null;
792 m_log.DebugFormat(
793 "[SceneObjectSerializer]: Parsing PhysicsInertiaData for object part {0} {1} encountered errors. Please see earlier log entries.",
794 obj.Name, obj.UUID);
795 }
796 else
797 {
798 obj.PhysicsInertia = pdata;
799 }
800 }
801
784 private static void ProcessShape(SceneObjectPart obj, XmlReader reader) 802 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
785 { 803 {
786 List<string> errorNodeNames; 804 List<string> errorNodeNames;
@@ -1498,6 +1516,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1498 if (sop.VehicleParams != null) 1516 if (sop.VehicleParams != null)
1499 sop.VehicleParams.ToXml2(writer); 1517 sop.VehicleParams.ToXml2(writer);
1500 1518
1519 if (sop.PhysicsInertia != null)
1520 sop.PhysicsInertia.ToXml2(writer);
1521
1501 if(sop.RotationAxisLocks != 0) 1522 if(sop.RotationAxisLocks != 0)
1502 writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower()); 1523 writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower());
1503 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); 1524 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());