If calling llStopMoveToTarget() on an in-world prim, don't send an unnecessary object update if the prim was not moving to target.

This involves making PhysicsActor.PIDActive get as well as set.
On physics components that don't implement this (all characters and some phys engines) we return false.
mb-throttle-test
Justin Clark-Casey 2014-11-19 20:06:56 +00:00
parent bdebd525db
commit 7a2c77e7ea
11 changed files with 46 additions and 21 deletions

View File

@ -1921,12 +1921,11 @@ namespace OpenSim.Region.Framework.Scenes
{
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
if (pa != null && pa.PIDActive)
{
pa.PIDActive = false;
ScheduleGroupForTerseUpdate();
//ParentGroup.ScheduleGroupForFullUpdate();
}
}
}

View File

@ -238,6 +238,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override bool PIDActive
{
get { return false; }
set { return; }
}

View File

@ -251,6 +251,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override bool PIDActive
{
get { return false; }
set { return; }
}

View File

@ -614,9 +614,9 @@ public sealed class BSCharacter : BSPhysObject
public override OMV.Vector3 PIDTarget {
set { _PIDTarget = value; }
}
public override bool PIDActive {
set { _usePID = value; }
}
public override bool PIDActive { get; set; }
public override float PIDTau {
set { _PIDTau = value; }
}

View File

@ -246,7 +246,12 @@ public abstract class BSPhysObject : PhysicsActor
public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; }
public override bool PIDActive { set { MoveToTargetActive = value; } }
public override bool PIDActive
{
get { return MoveToTargetActive; }
set { MoveToTargetActive = value; }
}
public override OMV.Vector3 PIDTarget { set { MoveToTargetTarget = value; } }
public override float PIDTau { set { MoveToTargetTau = value; } }

View File

@ -1087,9 +1087,17 @@ public class BSPrim : BSPhysObject
}
}
public override bool PIDActive {
set {
base.MoveToTargetActive = value;
public override bool PIDActive
{
get
{
return MoveToTargetActive;
}
set
{
MoveToTargetActive = value;
EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate()
{
return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName);

View File

@ -291,7 +291,7 @@ namespace OpenSim.Region.Physics.Manager
// Used for MoveTo
public abstract Vector3 PIDTarget { set; }
public abstract bool PIDActive { set;}
public abstract bool PIDActive { get; set; }
public abstract float PIDTau { set; }
// Used for llSetHoverHeight and maybe vehicle height
@ -545,7 +545,13 @@ namespace OpenSim.Region.Physics.Manager
}
public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override bool PIDActive
{
get { return false; }
set { return; }
}
public override float PIDTau { set { return; } }
public override float PIDHoverHeight { set { return; } }

View File

@ -1245,7 +1245,11 @@ namespace OpenSim.Region.Physics.OdePlugin
}
public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override bool PIDActive
{
get { return false; }
set { return; }
}
public override float PIDTau { set { return; } }
public override float PIDHoverHeight { set { return; } }

View File

@ -114,7 +114,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private float m_PIDTau;
private float PID_D = 35f;
private float PID_G = 25f;
private bool m_usePID;
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
// and are for non-VEHICLES only.
@ -1723,7 +1722,7 @@ Console.WriteLine(" JointCreateFixed");
// gravityz multiplier = 1 - m_buoyancy
fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass;
if (m_usePID)
if (PIDActive)
{
//Console.WriteLine("PID " + Name);
// KF - this is for object move? eg. llSetPos() ?
@ -1792,10 +1791,10 @@ Console.WriteLine(" JointCreateFixed");
fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass);
}
} // end if (m_usePID)
} // end if (PIDActive)
// Hover PID Controller needs to be mutually exlusive to MoveTo PID controller
if (m_useHoverPID && !m_usePID)
if (m_useHoverPID && !PIDActive)
{
//Console.WriteLine("Hover " + Name);
@ -2866,7 +2865,7 @@ Console.WriteLine(" JointCreateFixed");
// it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large.
// reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles
// adding these logical exclusion situations to maintain this where I think it was intended to be.
if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero))
if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero))
{
m_minvelocity = 0.5f;
}
@ -2947,7 +2946,7 @@ Console.WriteLine(" JointCreateFixed");
m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name);
}
}
public override bool PIDActive { set { m_usePID = value; } }
public override bool PIDActive { get; set; }
public override float PIDTau { set { m_PIDTau = value; } }
public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } }

View File

@ -273,9 +273,10 @@ namespace OpenSim.Region.Physics.POSPlugin
set { return; }
}
public override bool PIDActive
{
set { return; }
public override bool PIDActive
{
get { return false; }
set { return; }
}
public override float PIDTau

View File

@ -270,6 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
public override bool PIDActive
{
get { return false; }
set { return; }
}