diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index b4b7e7f..f934b8a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -114,7 +114,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
114 | private float m_PIDTau; | 114 | private float m_PIDTau; |
115 | private float PID_D = 35f; | 115 | private float PID_D = 35f; |
116 | private float PID_G = 25f; | 116 | private float PID_G = 25f; |
117 | private bool m_usePID; | ||
118 | 117 | ||
119 | // 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), |
120 | // and are for non-VEHICLES only. | 119 | // and are for non-VEHICLES only. |
@@ -351,11 +350,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
351 | if (m_assetFailed) | 350 | if (m_assetFailed) |
352 | { | 351 | { |
353 | d.GeomSetCategoryBits(prim_geom, 0); | 352 | d.GeomSetCategoryBits(prim_geom, 0); |
354 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 353 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
355 | } | 354 | } |
356 | else | 355 | else |
357 | { | 356 | { |
358 | |||
359 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 357 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
360 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 358 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
361 | } | 359 | } |
@@ -425,7 +423,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
425 | if (m_assetFailed) | 423 | if (m_assetFailed) |
426 | { | 424 | { |
427 | d.GeomSetCategoryBits(prim_geom, 0); | 425 | d.GeomSetCategoryBits(prim_geom, 0); |
428 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 426 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
429 | } | 427 | } |
430 | else | 428 | else |
431 | { | 429 | { |
@@ -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> |
@@ -858,11 +864,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
858 | 864 | ||
859 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); | 865 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); |
860 | 866 | ||
861 | public int BadAssetColideBits() | ||
862 | { | ||
863 | return (m_isphysical ? (int)CollisionCategories.Land : 0); | ||
864 | } | ||
865 | |||
866 | private void setMesh(OdeScene parent_scene, IMesh mesh) | 867 | private void setMesh(OdeScene parent_scene, IMesh mesh) |
867 | { | 868 | { |
868 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); | 869 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); |
@@ -1144,7 +1145,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1144 | if (prm.m_assetFailed) | 1145 | if (prm.m_assetFailed) |
1145 | { | 1146 | { |
1146 | d.GeomSetCategoryBits(prm.prim_geom, 0); | 1147 | d.GeomSetCategoryBits(prm.prim_geom, 0); |
1147 | d.GeomSetCollideBits(prm.prim_geom, prm.BadAssetColideBits()); | 1148 | d.GeomSetCollideBits(prm.prim_geom, prm.BadMeshAssetCollideBits); |
1148 | } | 1149 | } |
1149 | else | 1150 | else |
1150 | { | 1151 | { |
@@ -1198,7 +1199,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1198 | if (m_assetFailed) | 1199 | if (m_assetFailed) |
1199 | { | 1200 | { |
1200 | d.GeomSetCategoryBits(prim_geom, 0); | 1201 | d.GeomSetCategoryBits(prim_geom, 0); |
1201 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 1202 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
1202 | } | 1203 | } |
1203 | else | 1204 | else |
1204 | { | 1205 | { |
@@ -1400,7 +1401,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1400 | if (m_assetFailed) | 1401 | if (m_assetFailed) |
1401 | { | 1402 | { |
1402 | d.GeomSetCategoryBits(prim_geom, 0); | 1403 | d.GeomSetCategoryBits(prim_geom, 0); |
1403 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 1404 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
1404 | } | 1405 | } |
1405 | else | 1406 | else |
1406 | { | 1407 | { |
@@ -1729,7 +1730,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1729 | // gravityz multiplier = 1 - m_buoyancy | 1730 | // gravityz multiplier = 1 - m_buoyancy |
1730 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1731 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; |
1731 | 1732 | ||
1732 | if (m_usePID) | 1733 | if (PIDActive) |
1733 | { | 1734 | { |
1734 | //Console.WriteLine("PID " + Name); | 1735 | //Console.WriteLine("PID " + Name); |
1735 | // KF - this is for object move? eg. llSetPos() ? | 1736 | // KF - this is for object move? eg. llSetPos() ? |
@@ -1798,10 +1799,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1798 | 1799 | ||
1799 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1800 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
1800 | } | 1801 | } |
1801 | } // end if (m_usePID) | 1802 | } // end if (PIDActive) |
1802 | 1803 | ||
1803 | // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller | 1804 | // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller |
1804 | if (m_useHoverPID && !m_usePID) | 1805 | if (m_useHoverPID && !PIDActive) |
1805 | { | 1806 | { |
1806 | //Console.WriteLine("Hover " + Name); | 1807 | //Console.WriteLine("Hover " + Name); |
1807 | 1808 | ||
@@ -2144,7 +2145,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2144 | } | 2145 | } |
2145 | 2146 | ||
2146 | if (m_assetFailed) | 2147 | if (m_assetFailed) |
2147 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 2148 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
2148 | else | 2149 | else |
2149 | 2150 | ||
2150 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 2151 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
@@ -2652,6 +2653,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2652 | if (value.IsFinite()) | 2653 | if (value.IsFinite()) |
2653 | { | 2654 | { |
2654 | m_rotationalVelocity = value; | 2655 | m_rotationalVelocity = value; |
2656 | setAngularVelocity(value.X, value.Y, value.Z); | ||
2655 | } | 2657 | } |
2656 | else | 2658 | else |
2657 | { | 2659 | { |
@@ -2872,7 +2874,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2872 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. | 2874 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. |
2873 | // 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 | 2875 | // 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 |
2874 | // adding these logical exclusion situations to maintain this where I think it was intended to be. | 2876 | // adding these logical exclusion situations to maintain this where I think it was intended to be. |
2875 | if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) | 2877 | if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) |
2876 | { | 2878 | { |
2877 | m_minvelocity = 0.5f; | 2879 | m_minvelocity = 0.5f; |
2878 | } | 2880 | } |
@@ -2953,9 +2955,9 @@ Console.WriteLine(" JointCreateFixed"); | |||
2953 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); | 2955 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); |
2954 | } | 2956 | } |
2955 | } | 2957 | } |
2956 | public override bool PIDActive { set { m_usePID = value; } } | 2958 | public override bool PIDActive { get; set; } |
2957 | public override float PIDTau { set { m_PIDTau = value; } } | 2959 | public override float PIDTau { set { m_PIDTau = value; } } |
2958 | 2960 | ||
2959 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } | 2961 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } |
2960 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } | 2962 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } |
2961 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 2963 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
@@ -3350,7 +3352,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3350 | RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; | 3352 | RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; |
3351 | if (assetProvider != null) | 3353 | if (assetProvider != null) |
3352 | assetProvider(_pbs.SculptTexture, MeshAssetReceived); | 3354 | assetProvider(_pbs.SculptTexture, MeshAssetReceived); |
3353 | }); | 3355 | }, null, "ODEPrim.CheckMeshAsset"); |
3354 | } | 3356 | } |
3355 | } | 3357 | } |
3356 | 3358 | ||
@@ -3382,4 +3384,4 @@ Console.WriteLine(" JointCreateFixed"); | |||
3382 | } | 3384 | } |
3383 | } | 3385 | } |
3384 | } | 3386 | } |
3385 | } | 3387 | } \ No newline at end of file |