aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorCharles Krinke2009-03-06 23:01:35 +0000
committerCharles Krinke2009-03-06 23:01:35 +0000
commitb637a11b58292cb6165317b317dc077a79ee6779 (patch)
tree18d9b2e82ae782fec726f3baa2d60c76433a7406 /OpenSim/Region/ScriptEngine/Shared
parentadd back .config files for all tests in an attempt to debug why these (diff)
downloadopensim-SC_OLD-b637a11b58292cb6165317b317dc077a79ee6779.zip
opensim-SC_OLD-b637a11b58292cb6165317b317dc077a79ee6779.tar.gz
opensim-SC_OLD-b637a11b58292cb6165317b317dc077a79ee6779.tar.bz2
opensim-SC_OLD-b637a11b58292cb6165317b317dc077a79ee6779.tar.xz
Fixes Mantis #3260. Thank you kindly, MCortez for a patch that:
llSetHoverHeight() should not clamp the x/y position of an object the way MoveTo does, and it should recalculate the absolute height to hover at as an object moves to reflect the current ground/water height under it. Correctly implementing required adjusting the Physics interfaces and implementing at the physics plug-in level. The attached is a patch that correctly implements llSetHoverHeight() including updates to the ODE physics plug-in.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs29
1 files changed, 13 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 517453e..62b52f2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2793,26 +2793,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2793 } 2793 }
2794 } 2794 }
2795 2795
2796 /// <summary>
2797 /// Attempt to clamp the object on the Z axis at the given height over tau seconds.
2798 /// </summary>
2799 /// <param name="height">Height to hover. Height of zero disables hover.</param>
2800 /// <param name="water">False if height is calculated just from ground, otherwise uses ground or water depending on whichever is higher</param>
2801 /// <param name="tau">Number of seconds over which to reach target</param>
2796 public void llSetHoverHeight(double height, int water, double tau) 2802 public void llSetHoverHeight(double height, int water, double tau)
2797 { 2803 {
2798 m_host.AddScriptLPS(1); 2804 m_host.AddScriptLPS(1);
2799 Vector3 pos = m_host.GetWorldPosition(); 2805 if (m_host.PhysActor != null)
2800 int x = (int)(pos.X);
2801 int y = (int)(pos.Y);
2802 float landHeight = (float)World.Heightmap[x, y];
2803 float targetHeight = landHeight + (float)height;
2804 if (water == 1)
2805 { 2806 {
2806 float waterHeight = (float)World.RegionInfo.RegionSettings.WaterHeight; 2807 PIDHoverType hoverType = PIDHoverType.Ground;
2807 if (waterHeight > targetHeight) 2808 if (water == 1)
2808 { 2809 {
2809 targetHeight = waterHeight + (float)height; 2810 hoverType = PIDHoverType.GroundAndWater;
2810 } 2811 }
2811 } 2812
2812 if (m_host.PhysActor != null) 2813 m_host.SetHoverHeight((float)height, hoverType, (float)tau);
2813 {
2814 m_host.MoveToTarget(new Vector3(pos.X, pos.Y, targetHeight), (float)tau);
2815 m_host.PhysActor.Flying = true;
2816 } 2814 }
2817 } 2815 }
2818 2816
@@ -2821,8 +2819,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2821 m_host.AddScriptLPS(1); 2819 m_host.AddScriptLPS(1);
2822 if (m_host.PhysActor != null) 2820 if (m_host.PhysActor != null)
2823 { 2821 {
2824 m_host.PhysActor.Flying = false; 2822 m_host.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
2825 m_host.PhysActor.PIDActive = false;
2826 } 2823 }
2827 } 2824 }
2828 2825