aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2017-04-01 17:49:17 +0100
committerUbitUmarov2017-04-01 17:49:17 +0100
commit443fc60cdf399a49832e787ca58c2644bef7e457 (patch)
tree103b547e95ced12fbc22109b82ac692f92068002 /OpenSim/Region
parent add missing file. Changes of inertia data of objects running does not (diff)
downloadopensim-SC_OLD-443fc60cdf399a49832e787ca58c2644bef7e457.zip
opensim-SC_OLD-443fc60cdf399a49832e787ca58c2644bef7e457.tar.gz
opensim-SC_OLD-443fc60cdf399a49832e787ca58c2644bef7e457.tar.bz2
opensim-SC_OLD-443fc60cdf399a49832e787ca58c2644bef7e457.tar.xz
store the physics inertia override in Mysql and add it to serializer. run prebuild is required
Diffstat (limited to 'OpenSim/Region')
-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
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs22
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs3
5 files changed, 53 insertions, 36 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());
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index ad9b28f..d23d9c1 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -55,28 +55,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
55 Absolute 55 Absolute
56 } 56 }
57 57
58 public class PhysicsInertiaData
59 {
60 public float TotalMass; // the total mass of a linkset
61 public Vector3 CenterOfMass; // the center of mass position relative to root part position
62 public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords
63 public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation
64 // or the upper triangle of the inertia tensor
65 // Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy))
66
67 public PhysicsInertiaData()
68 {
69 }
70
71 public PhysicsInertiaData(PhysicsInertiaData source)
72 {
73 TotalMass = source.TotalMass;
74 CenterOfMass = source.CenterOfMass;
75 Inertia = source.Inertia;
76 InertiaRotation = source.InertiaRotation;
77 }
78 }
79
80 public struct CameraData 58 public struct CameraData
81 { 59 {
82 public Quaternion CameraRotation; 60 public Quaternion CameraRotation;
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index d560b41..f784990 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -568,9 +568,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
568 { 568 {
569 get 569 get
570 { 570 {
571 if(!childPrim && m_fakeInertiaOverride != null)
572 return m_fakeInertiaOverride.CenterOfMass;
573
574 lock (_parent_scene.OdeLock) 571 lock (_parent_scene.OdeLock)
575 { 572 {
576 d.AllocateODEDataForThread(0); 573 d.AllocateODEDataForThread(0);