From b637a11b58292cb6165317b317dc077a79ee6779 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Fri, 6 Mar 2009 23:01:35 +0000
Subject: 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.
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 31 ++++++++++++++++++++++
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 ++++++++++++
2 files changed, 48 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4f61342..a88f8a9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1617,6 +1617,37 @@ namespace OpenSim.Region.Framework.Scenes
}
///
+ /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
+ ///
+ /// Height to hover. Height of zero disables hover.
+ /// Determines what the height is relative to
+ /// Number of seconds over which to reach target
+ public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
+ {
+ SceneObjectPart rootpart = m_rootPart;
+ if (rootpart != null)
+ {
+ if (rootpart.PhysActor != null)
+ {
+ if (height != 0f)
+ {
+ rootpart.PhysActor.PIDHoverHeight = height;
+ rootpart.PhysActor.PIDHoverType = hoverType;
+ rootpart.PhysActor.PIDTau = tau;
+ rootpart.PhysActor.PIDHoverActive = true;
+ }
+ else
+ {
+ rootpart.PhysActor.PIDHoverActive = false;
+ }
+ }
+ }
+ }
+
+
+
+
+ ///
/// Set the owner of the root part.
///
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ede007e..4efadc3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1748,6 +1748,23 @@ if (m_shape != null) {
}
}
+ ///
+ /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
+ ///
+ /// Height to hover. Height of zero disables hover.
+ /// Determines what the height is relative to
+ /// Number of seconds over which to reach target
+ public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
+ {
+ m_parentGroup.SetHoverHeight(height, hoverType, tau);
+ }
+
+ public void StopHover()
+ {
+ m_parentGroup.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
+ }
+
+
public virtual void OnGrab(Vector3 offsetPos, IClientAPI remoteClient)
{
}
--
cgit v1.1