From 7a2c77e7eace93d722ef37595e9fab21d3cd266f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey Date: Wed, 19 Nov 2014 20:06:56 +0000 Subject: 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. --- .../Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | 1 + .../Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs | 1 + OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 6 +++--- OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 7 ++++++- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 14 +++++++++++--- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 10 ++++++++-- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 6 +++++- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 11 +++++------ OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 7 ++++--- OpenSim/Region/Physics/POSPlugin/POSPrim.cs | 1 + 10 files changed, 45 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index c1a37cc..43fba7b 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs @@ -238,6 +238,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override bool PIDActive { + get { return false; } set { return; } } diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs index 47d7df3..dfe4c19 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs @@ -251,6 +251,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override bool PIDActive { + get { return false; } set { return; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 9b56fb4..a303972 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -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; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 75ffeb4..f059322 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -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; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index edec949..27ee5ac 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -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); diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 1750853..6bc6e23 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -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; } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 8f37b79..67503df 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -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; } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 13c69d6..e347fdc 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -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; ; } } diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index ae534ea..40ab984 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs @@ -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 diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index e4fd7eb..7c1e915 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs @@ -270,6 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin public override bool PIDActive { + get { return false; } set { return; } } -- cgit v1.1