aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2012-04-27 23:18:54 +0100
committerUbitUmarov2012-04-27 23:18:54 +0100
commite48fa38ff581bd1125b9582ed3efc875f723ae86 (patch)
tree074997633d76d07d3ee46b4aac6f9c8f6dbf6708 /OpenSim
parentreorder priority of vehicle hover flags (diff)
downloadopensim-SC_OLD-e48fa38ff581bd1125b9582ed3efc875f723ae86.zip
opensim-SC_OLD-e48fa38ff581bd1125b9582ed3efc875f723ae86.tar.gz
opensim-SC_OLD-e48fa38ff581bd1125b9582ed3efc875f723ae86.tar.bz2
opensim-SC_OLD-e48fa38ff581bd1125b9582ed3efc875f723ae86.tar.xz
Oooops don't hover underground but do hover
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs53
1 files changed, 27 insertions, 26 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
index 53a576e..d106677 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
@@ -773,39 +773,40 @@ namespace OpenSim.Region.Physics.OdePlugin
773 d.Vector3 pos = d.BodyGetPosition(Body); 773 d.Vector3 pos = d.BodyGetPosition(Body);
774 774
775 float t = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y); 775 float t = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y);
776 float perr;
776 777
777 if (t < m_VhoverHeight) // don't go underground 778 // default to global but don't go underground
778 { 779 if (t < m_VhoverHeight)
779 // default to global 780 perr = m_VhoverHeight - pos.Z;
780 float perr = m_VhoverHeight - pos.Z; ; 781 else
782 perr = t - pos.Z; ;
781 783
782 if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) == 0) 784 if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) == 0)
785 {
786 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0)
783 { 787 {
784 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0) 788 perr += _pParentScene.GetWaterLevel();
785 {
786 perr += _pParentScene.GetWaterLevel();
787 }
788 else if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
789 {
790 perr += t;
791 }
792 else
793 {
794 float w = _pParentScene.GetWaterLevel();
795 if (t > w)
796 perr += t;
797 else
798 perr += w;
799 }
800 } 789 }
801 if ((m_flags & VehicleFlag.HOVER_UP_ONLY) == 0 || perr > 0) 790 else if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
802 { 791 {
803 force.Z += (perr / m_VhoverTimescale / m_VhoverTimescale - curVel.Z * m_VhoverEfficiency) / m_timestep; 792 perr += t;
804 force.Z += _pParentScene.gravityz * (1f - m_VehicleBuoyancy);
805 } 793 }
806 else // no buoyancy 794 else
807 force.Z += _pParentScene.gravityz; 795 {
796 float w = _pParentScene.GetWaterLevel();
797 if (t > w)
798 perr += t;
799 else
800 perr += w;
801 }
802 }
803 if ((m_flags & VehicleFlag.HOVER_UP_ONLY) == 0 || perr > 0)
804 {
805 force.Z += (perr / m_VhoverTimescale / m_VhoverTimescale - curVel.Z * m_VhoverEfficiency) / m_timestep;
806 force.Z += _pParentScene.gravityz * (1f - m_VehicleBuoyancy);
808 } 807 }
808 else // no buoyancy
809 force.Z += _pParentScene.gravityz;
809 } 810 }
810 else 811 else
811 { 812 {