add high level code suport for SetHoverHeight() called from a attachment, so in future physics engines can also suport it

avinationmerge
UbitUmarov 2015-09-30 17:34:25 +01:00
parent d281ec5342
commit 4a2e6db344
2 changed files with 14 additions and 13 deletions

View File

@ -2579,7 +2579,15 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="tau">Number of seconds over which to reach target</param> /// <param name="tau">Number of seconds over which to reach target</param>
public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
{ {
PhysicsActor pa = RootPart.PhysActor; PhysicsActor pa = null;
if(IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null)
pa = avatar.PhysicsActor;
}
else
pa = RootPart.PhysActor;
if (pa != null) if (pa != null)
{ {

View File

@ -3942,25 +3942,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.PhysActor != null) PIDHoverType hoverType = PIDHoverType.Ground;
if (water != 0)
{ {
PIDHoverType hoverType = PIDHoverType.Ground; hoverType = PIDHoverType.GroundAndWater;
if (water != 0)
{
hoverType = PIDHoverType.GroundAndWater;
}
m_host.SetHoverHeight((float)height, hoverType, (float)tau);
} }
m_host.SetHoverHeight((float)height, hoverType, (float)tau);
} }
public void llStopHover() public void llStopHover()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.PhysActor != null) m_host.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
{
m_host.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
}
} }
public void llMinEventDelay(double delay) public void llMinEventDelay(double delay)