From 2998a2df6a6c56f52d56d85bcec869e4a76ad169 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 26 Sep 2012 22:30:09 +0200 Subject: Streamline and improve llGetMass --- .../Shared/Api/Implementation/LSL_Api.cs | 40 +++++++++------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f9b4bfd..05aaebf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10599,31 +10599,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID key = new UUID(); if (UUID.TryParse(id, out key)) { - try - { - /* - SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId); - if (obj != null) - return (double)obj.GetMass(); - */ - // return total object mass - SceneObjectGroup obj = World.GetGroupByPrim(World.Entities[key].LocalId); - if (obj != null) - return obj.GetMass(); + // return total object mass + SceneObjectPart part = World.GetSceneObjectPart(key); + if (part != null) + return part.ParentGroup.GetMass(); - // the object is null so the key is for an avatar - ScenePresence avatar = World.GetScenePresence(key); - if (avatar != null) - if (avatar.IsChildAgent) - // reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass - // child agents have a mass of 1.0 - return 1; - else - return (double)avatar.GetMass(); - } - catch (KeyNotFoundException) + // the object is null so the key is for an avatar + ScenePresence avatar = World.GetScenePresence(key); + if (avatar != null) { - return 0; // The Object/Agent not in the region so just return zero + if (avatar.IsChildAgent) + { + // reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass + // child agents have a mass of 1.0 + return 1; + } + else + { + return (double)avatar.GetMass(); + } } } return 0; -- cgit v1.1 From 285039949c8a0c0b13da8b74d2ce560805932ad9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 27 Sep 2012 18:27:49 +0100 Subject: Update the Http server with a few additional properties. Adapt the test server code to match. --- OpenSim/Framework/Servers/Tests/OSHttpTests.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index dc4eb8f..4c2f586 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs @@ -75,6 +75,10 @@ namespace OpenSim.Framework.Servers.Tests /// public event EventHandler RequestReceived = delegate { }; + public bool CanSend { get { return true; } } + public string RemoteEndPoint { get { return ""; } } + public string RemoteEndPointAddress { get { return ""; } } + public string RemoteEndPointPort { get { return ""; } } } public class TestHttpRequest: IHttpRequest -- cgit v1.1 From 58e55ae0756250f58f56cb59f75d18a512f17815 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 27 Sep 2012 23:14:42 +0100 Subject: make some forgotten changes be done by simulation thread not by caller --- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 149 +++++++++++++++++------ OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 11 ++ 2 files changed, 126 insertions(+), 34 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 61d5a1d..f2f4725 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -161,9 +161,6 @@ namespace OpenSim.Region.Physics.OdePlugin private List childrenPrim = new List(); - -// private bool m_throttleUpdates; -// private int throttleCounter; public float m_collisionscore; private int m_colliderfilter = 0; @@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool m_lastUpdateSent; public IntPtr Body = IntPtr.Zero; -// public String Name { get; private set; } + private Vector3 _target_velocity; public Vector3 primOOBsize; // prim real dimensions from mesh @@ -366,12 +363,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override bool ThrottleUpdates {get;set;} -/* - { - get { return m_throttleUpdates; } - set { m_throttleUpdates = value; } - } -*/ + public override bool Stopped { get { return _zeroFlag; } @@ -418,7 +410,6 @@ namespace OpenSim.Region.Physics.OdePlugin public override Vector3 Force { - //get { return Vector3.Zero; } get { return m_force; } set { @@ -673,7 +664,7 @@ namespace OpenSim.Region.Physics.OdePlugin get { return m_buoyancy; } set { - m_buoyancy = value; + AddChange(changes.Buoyancy,value); } } @@ -691,28 +682,35 @@ namespace OpenSim.Region.Physics.OdePlugin { if (value.IsFinite()) { - m_PIDTarget = value; + AddChange(changes.PIDTarget,value); } else 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 + { + set + { + AddChange(changes.PIDActive,value); + } + } + public override float PIDTau { set { - if (value <= 0) - m_PIDTau = 0; - else + float tmp = 0; + if (value > 0) { float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); if (value < mint) - m_PIDTau = mint; + tmp = mint; else - m_PIDTau = value; + tmp = value; } + AddChange(changes.PIDTau,tmp); } } @@ -720,27 +718,39 @@ namespace OpenSim.Region.Physics.OdePlugin { set { - m_PIDHoverHeight = value; - if (value == 0) - m_useHoverPID = false; + AddChange(changes.PIDHoverHeight,value); + } + } + public override bool PIDHoverActive + { + set + { + AddChange(changes.PIDHoverActive, value); } } - public override bool PIDHoverActive { set { m_useHoverPID = value; } } - public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } + + public override PIDHoverType PIDHoverType + { + set + { + AddChange(changes.PIDHoverType,value); + } + } + public override float PIDHoverTau { set { - if (value <= 0) - m_PIDHoverTau = 0; - else + float tmp =0; + if (value > 0) { float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); if (value < mint) - m_PIDHoverTau = mint; + tmp = mint; else - m_PIDHoverTau = value; + tmp = value; } + AddChange(changes.PIDHoverTau, tmp); } } @@ -981,7 +991,6 @@ namespace OpenSim.Region.Physics.OdePlugin return false; } - public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID) { @@ -3099,7 +3108,6 @@ namespace OpenSim.Region.Physics.OdePlugin resetCollisionAccounting(); } - private void changeDisable(bool disable) { if (disable) @@ -3250,7 +3258,6 @@ namespace OpenSim.Region.Physics.OdePlugin d.BodyEnable(Body); } - private void changeAddForce(Vector3 theforce) { m_forceacc += theforce; @@ -3267,7 +3274,6 @@ namespace OpenSim.Region.Physics.OdePlugin d.BodyEnable(Body); } } - m_collisionscore = 0; } } @@ -3317,7 +3323,6 @@ namespace OpenSim.Region.Physics.OdePlugin _velocity = newVel; } - private void changeangvelocity(Vector3 newAngVel) { float len = newAngVel.LengthSquared(); @@ -3384,6 +3389,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_vehicle = new ODEDynamics(this); m_vehicle.DoSetVehicle(vdata); } + private void changeVehicleType(int value) { if (value == (int)Vehicle.TYPE_NONE) @@ -3429,6 +3435,48 @@ namespace OpenSim.Region.Physics.OdePlugin m_vehicle.ProcessVehicleFlags(bp.param, bp.value); } + private void changeBuoyancy(float b) + { + m_buoyancy = b; + } + + private void changePIDTarget(Vector3 trg) + { + m_PIDTarget = trg; + } + + private void changePIDTau(float tau) + { + m_PIDTau = tau; + } + + private void changePIDActive(bool val) + { + m_usePID = val; + } + + private void changePIDHoverHeight(float val) + { + m_PIDHoverHeight = val; + if (val == 0) + m_useHoverPID = false; + } + + private void changePIDHoverType(PIDHoverType type) + { + m_PIDHoverType = type; + } + + private void changePIDHoverTau(float tau) + { + m_PIDHoverTau = tau; + } + + private void changePIDHoverActive(bool active) + { + m_useHoverPID = active; + } + #endregion public void Move() @@ -3987,6 +4035,39 @@ namespace OpenSim.Region.Physics.OdePlugin case changes.SetVehicle: changeSetVehicle((VehicleData) arg); break; + + case changes.Buoyancy: + changeBuoyancy((float)arg); + break; + + case changes.PIDTarget: + changePIDTarget((Vector3)arg); + break; + + case changes.PIDTau: + changePIDTau((float)arg); + break; + + case changes.PIDActive: + changePIDActive((bool)arg); + break; + + case changes.PIDHoverHeight: + changePIDHoverHeight((float)arg); + break; + + case changes.PIDHoverType: + changePIDHoverType((PIDHoverType)arg); + break; + + case changes.PIDHoverTau: + changePIDHoverTau((float)arg); + break; + + case changes.PIDHoverActive: + changePIDHoverActive((bool)arg); + break; + case changes.Null: donullchange(); break; diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 3ee5198..f126644 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -134,6 +134,17 @@ namespace OpenSim.Region.Physics.OdePlugin AddAngForce, AngLock, + Buoyancy, + + PIDTarget, + PIDTau, + PIDActive, + + PIDHoverHeight, + PIDHoverType, + PIDHoverTau, + PIDHoverActive, + Size, Shape, -- cgit v1.1