示例#1
0
        public void llGroundRepel(double height, int water, double tau)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            if (m_host.PhysActor != null)
            {
                float        ground     = (float)llGround(new LSL_Vector(0, 0, 0));
                float        waterLevel = (float)llWater(new LSL_Vector(0, 0, 0));
                PIDHoverType hoverType  = PIDHoverType.Ground;
                if (water != 0)
                {
                    hoverType = PIDHoverType.GroundAndWater;
                    if (ground < waterLevel)
                    {
                        height += waterLevel;
                    }
                    else
                    {
                        height += ground;
                    }
                }
                else
                {
                    height += ground;
                }

                m_host.SetHoverHeight((float)height, hoverType, (float)tau);
            }
        }
示例#2
0
        /// <summary>
        ///     Attempt to clamp the object on the Z axis at the given height over tau seconds.
        /// </summary>
        /// <param name="height">Height to hover.  Height of zero disables hover.</param>
        /// <param name="water">False if height is calculated just from ground, otherwise uses ground or water depending on whichever is higher</param>
        /// <param name="tau">Number of seconds over which to reach target</param>
        public void llSetHoverHeight(double height, int water, double tau)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            if (m_host.PhysActor != null)
            {
                PIDHoverType hoverType = PIDHoverType.Ground;
                if (water != 0)
                {
                    hoverType = PIDHoverType.GroundAndWater;
                }

                m_host.SetHoverHeight((float)height, hoverType, (float)tau);
            }
        }
 /// <summary>
 /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
 /// </summary>
 /// <param name="height">Height to hover.  Height of zero disables hover.</param>
 /// <param name="hoverType">Determines what the height is relative to </param>
 /// <param name="tau">Number of seconds over which to reach target</param>
 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;
             }
         }
     }
 }
示例#4
0
 /// <summary>
 /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
 /// </summary>
 /// <param name="height">Height to hover.  Height of zero disables hover.</param>
 /// <param name="hoverType">Determines what the height is relative to </param>
 /// <param name="tau">Number of seconds over which to reach target</param>
 public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
 {
     ParentGroup.SetHoverHeight(height, hoverType, tau);
 }
        /// <summary>
        /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
        /// </summary>
        /// <param name="height">Height to hover.  Height of zero disables hover.</param>
        /// <param name="hoverType">Determines what the height is relative to </param>
        /// <param name="tau">Number of seconds over which to reach target</param>
        public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
        {
            PhysicsActor pa = RootPart.PhysActor;

            if (pa != null)
            {
                if (height != 0f)
                {
                    pa.PIDHoverHeight = height;
                    pa.PIDHoverType = hoverType;
                    pa.PIDTau = tau;
                    pa.PIDHoverActive = true;
                }
                else
                {
                    pa.PIDHoverActive = false;
                }
            }
        }
示例#6
0
 /// <summary>
 /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
 /// </summary>
 /// <param name="height">Height to hover.  Height of zero disables hover.</param>
 /// <param name="hoverType">Determines what the height is relative to </param>
 /// <param name="tau">Number of seconds over which to reach target</param>
 public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
 {
     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;
         }
     }
 }
        /// <summary>
        /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
        /// </summary>
        /// <param name="height">Height to hover.  Height of zero disables hover.</param>
        /// <param name="hoverType">Determines what the height is relative to </param>
        /// <param name="tau">Number of seconds over which to reach target</param>
        public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
        {
            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 (height != 0f)
                {
                    pa.PIDHoverHeight = height;
                    pa.PIDHoverType = hoverType;
                    pa.PIDHoverTau = tau;
                    pa.PIDHoverActive = true;
                }
                else
                {
                    pa.PIDHoverActive = false;
                }
            }
        }
示例#8
0
 private void changePIDHoverType(PIDHoverType type)
 {
     m_PIDHoverType = type;
 }