aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODEPrim.cs)40
1 files changed, 21 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
index 0d66496..0b9c45f 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
@@ -50,9 +50,9 @@ using log4net;
50using OpenMetaverse; 50using OpenMetaverse;
51using Ode.NET; 51using Ode.NET;
52using OpenSim.Framework; 52using OpenSim.Framework;
53using OpenSim.Region.Physics.Manager; 53using OpenSim.Region.PhysicsModules.SharedBase;
54 54
55namespace OpenSim.Region.Physics.OdePlugin 55namespace OpenSim.Region.PhysicsModule.ODE
56{ 56{
57 /// <summary> 57 /// <summary>
58 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. 58 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
@@ -108,14 +108,12 @@ namespace OpenSim.Region.Physics.OdePlugin
108 private Vector3 m_taintAngularLock = Vector3.One; 108 private Vector3 m_taintAngularLock = Vector3.One;
109 private IntPtr Amotor = IntPtr.Zero; 109 private IntPtr Amotor = IntPtr.Zero;
110 110
111 private object m_assetsLock = new object();
112 private bool m_assetFailed = false; 111 private bool m_assetFailed = false;
113 112
114 private Vector3 m_PIDTarget; 113 private Vector3 m_PIDTarget;
115 private float m_PIDTau; 114 private float m_PIDTau;
116 private float PID_D = 35f; 115 private float PID_D = 35f;
117 private float PID_G = 25f; 116 private float PID_G = 25f;
118 private bool m_usePID;
119 117
120 // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), 118 // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
121 // and are for non-VEHICLES only. 119 // and are for non-VEHICLES only.
@@ -447,7 +445,7 @@ namespace OpenSim.Region.Physics.OdePlugin
447 m_disabled = false; 445 m_disabled = false;
448 446
449 // The body doesn't already have a finite rotation mode set here 447 // The body doesn't already have a finite rotation mode set here
450 if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null) 448 if ((!m_angularlock.ApproxEquals(Vector3.One, 0.0f)) && _parent == null)
451 { 449 {
452 createAMotor(m_angularlock); 450 createAMotor(m_angularlock);
453 } 451 }
@@ -787,6 +785,14 @@ namespace OpenSim.Region.Physics.OdePlugin
787 } 785 }
788 } 786 }
789 787
788 private void setAngularVelocity(float x, float y, float z)
789 {
790 if (Body != (IntPtr)0)
791 {
792 d.BodySetAngularVel(Body, x, y, z);
793 }
794 }
795
790 /// <summary> 796 /// <summary>
791 /// Stop a prim from being subject to physics. 797 /// Stop a prim from being subject to physics.
792 /// </summary> 798 /// </summary>
@@ -1115,7 +1121,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1115 { 1121 {
1116 d.Mass m2; 1122 d.Mass m2;
1117 d.MassSetZero(out m2); 1123 d.MassSetZero(out m2);
1118 d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); 1124 d.MassSetBoxTotal(out m2, prm.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
1119 1125
1120 d.Quaternion quat = new d.Quaternion(); 1126 d.Quaternion quat = new d.Quaternion();
1121 quat.W = prm._orientation.W; 1127 quat.W = prm._orientation.W;
@@ -1178,11 +1184,6 @@ Console.WriteLine("ZProcessTaints for " + Name);
1178 prm.m_collisionscore = 0; 1184 prm.m_collisionscore = 0;
1179 prm.m_disabled = false; 1185 prm.m_disabled = false;
1180 1186
1181 // The body doesn't already have a finite rotation mode set here
1182 if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
1183 {
1184 prm.createAMotor(m_angularlock);
1185 }
1186 prm.Body = Body; 1187 prm.Body = Body;
1187 _parent_scene.ActivatePrim(prm); 1188 _parent_scene.ActivatePrim(prm);
1188 } 1189 }
@@ -1229,7 +1230,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1229 m_disabled = false; 1230 m_disabled = false;
1230 1231
1231 // The body doesn't already have a finite rotation mode set here 1232 // The body doesn't already have a finite rotation mode set here
1232 if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) 1233 if ((!m_angularlock.ApproxEquals(Vector3.One, 0f)) && _parent == null)
1233 { 1234 {
1234 createAMotor(m_angularlock); 1235 createAMotor(m_angularlock);
1235 } 1236 }
@@ -1724,7 +1725,7 @@ Console.WriteLine(" JointCreateFixed");
1724 // gravityz multiplier = 1 - m_buoyancy 1725 // gravityz multiplier = 1 - m_buoyancy
1725 fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; 1726 fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass;
1726 1727
1727 if (m_usePID) 1728 if (PIDActive)
1728 { 1729 {
1729//Console.WriteLine("PID " + Name); 1730//Console.WriteLine("PID " + Name);
1730 // KF - this is for object move? eg. llSetPos() ? 1731 // KF - this is for object move? eg. llSetPos() ?
@@ -1793,10 +1794,10 @@ Console.WriteLine(" JointCreateFixed");
1793 1794
1794 fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); 1795 fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass);
1795 } 1796 }
1796 } // end if (m_usePID) 1797 } // end if (PIDActive)
1797 1798
1798 // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller 1799 // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller
1799 if (m_useHoverPID && !m_usePID) 1800 if (m_useHoverPID && !PIDActive)
1800 { 1801 {
1801//Console.WriteLine("Hover " + Name); 1802//Console.WriteLine("Hover " + Name);
1802 1803
@@ -2647,6 +2648,7 @@ Console.WriteLine(" JointCreateFixed");
2647 if (value.IsFinite()) 2648 if (value.IsFinite())
2648 { 2649 {
2649 m_rotationalVelocity = value; 2650 m_rotationalVelocity = value;
2651 setAngularVelocity(value.X, value.Y, value.Z);
2650 } 2652 }
2651 else 2653 else
2652 { 2654 {
@@ -2867,7 +2869,7 @@ Console.WriteLine(" JointCreateFixed");
2867 // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. 2869 // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large.
2868 // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles 2870 // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles
2869 // adding these logical exclusion situations to maintain this where I think it was intended to be. 2871 // adding these logical exclusion situations to maintain this where I think it was intended to be.
2870 if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) 2872 if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero))
2871 { 2873 {
2872 m_minvelocity = 0.5f; 2874 m_minvelocity = 0.5f;
2873 } 2875 }
@@ -2948,7 +2950,7 @@ Console.WriteLine(" JointCreateFixed");
2948 m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); 2950 m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name);
2949 } 2951 }
2950 } 2952 }
2951 public override bool PIDActive { set { m_usePID = value; } } 2953 public override bool PIDActive { get; set; }
2952 public override float PIDTau { set { m_PIDTau = value; } } 2954 public override float PIDTau { set { m_PIDTau = value; } }
2953 2955
2954 public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } 2956 public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } }
@@ -3345,7 +3347,7 @@ Console.WriteLine(" JointCreateFixed");
3345 RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; 3347 RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod;
3346 if (assetProvider != null) 3348 if (assetProvider != null)
3347 assetProvider(_pbs.SculptTexture, MeshAssetReceived); 3349 assetProvider(_pbs.SculptTexture, MeshAssetReceived);
3348 }); 3350 }, null, "ODEPrim.CheckMeshAsset");
3349 } 3351 }
3350 } 3352 }
3351 3353
@@ -3373,7 +3375,7 @@ Console.WriteLine(" JointCreateFixed");
3373 { 3375 {
3374 m_log.WarnFormat( 3376 m_log.WarnFormat(
3375 "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", 3377 "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}",
3376 _pbs.SculptTexture, Name, _position, _parent_scene.Name); 3378 _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName);
3377 } 3379 }
3378 } 3380 }
3379 } 3381 }