From d7e24542818ed3edfa57ce748ad2c0bad8f694f4 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Apr 2012 14:24:13 +0100
Subject: ubitODE: - made avatar/ground collision pid servo a bit softer since
seems a bit unstable with small avas in AVI even if fine on my testsite -
Removed reading of PID parameters from config files since that only serves to
mess things up and adds more unknowns
---
OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 4 ++--
OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 9 +++++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index 9c1b87b..1c8de56 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -851,10 +851,10 @@ namespace OpenSim.Region.Physics.OdePlugin
float depth = terrainheight - chrminZ;
if (!flying)
{
- vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 50;
+ vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 30;
}
else
- vec.Z = depth * PID_P * 50;
+ vec.Z = depth * PID_P * 30;
/*
Vector3 vtmp;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 7632e25..837eae3 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -455,15 +455,15 @@ namespace OpenSim.Region.Physics.OdePlugin
geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity);
bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable);
-
+/*
bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", bodyPIDD);
bodyPIDG = physicsconfig.GetFloat("body_pid_gain", bodyPIDG);
-
+*/
forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing);
meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim);
meshSculptLOD = physicsconfig.GetFloat("mesh_lod", meshSculptLOD);
MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD);
-
+/*
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", avPIDD);
@@ -471,10 +471,11 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
+
avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", avPIDD);
avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", avPIDP);
}
-
+*/
physics_logging = physicsconfig.GetBoolean("physics_logging", false);
physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
--
cgit v1.1
From 9132c9e49963c656e303815e5cb9e0c4341f0821 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Apr 2012 15:50:14 +0100
Subject: ubitODE: - character managed ode was only getting position etc from
unmanaged at heartbeat rate like core ode. Now do it at ODE rate in move(..).
UpdatePositionAndVelocity() called once per heartbeat is now empty.
---
.../Region/Physics/UbitOdePlugin/ODECharacter.cs | 162 ++++++---------------
OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 5 +-
2 files changed, 48 insertions(+), 119 deletions(-)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index 1c8de56..b9ec6b5 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -771,16 +771,10 @@ namespace OpenSim.Region.Physics.OdePlugin
///
public void Move(float timeStep, List defects)
{
- // no lock; for now it's only called from within Simulate()
-
- // If the PID Controller isn't active then we set our force
- // calculating base velocity to the current position
-
if (Body == IntPtr.Zero)
return;
- d.Vector3 dtmp;
- d.BodyCopyPosition(Body, out dtmp);
+ d.Vector3 dtmp = d.BodyGetPosition(Body);
Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z);
// the Amotor still lets avatar rotation to drift during colisions
@@ -797,22 +791,43 @@ namespace OpenSim.Region.Physics.OdePlugin
{
_zeroPosition = localpos;
}
- //PidStatus = true;
-
if (!localpos.IsFinite())
{
-
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
defects.Add(this);
// _parent_scene.RemoveCharacter(this);
// destroy avatar capsule and related ODE data
AvatarGeomAndBodyDestroy();
-
return;
}
+ // check outbounds forcing to be in world
+ bool fixbody = false;
+ if (localpos.X < 0.0f)
+ {
+ fixbody = true;
+ localpos.X = 0.1f;
+ }
+ else if (localpos.X > _parent_scene.WorldExtents.X - 0.1f)
+ {
+ fixbody = true;
+ localpos.X = _parent_scene.WorldExtents.X - 0.1f;
+ }
+ if (localpos.Y < 0.0f)
+ {
+ fixbody = true;
+ localpos.Y = 0.1f;
+ }
+ else if (localpos.Y > _parent_scene.WorldExtents.Y - 0.1)
+ {
+ fixbody = true;
+ localpos.Y = _parent_scene.WorldExtents.Y - 0.1f;
+ }
+ if (fixbody)
+ d.BodySetPosition(Body, localpos.X, localpos.Y, localpos.Z);
+
Vector3 vec = Vector3.Zero;
dtmp = d.BodyGetLinearVel(Body);
Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z);
@@ -820,16 +835,12 @@ namespace OpenSim.Region.Physics.OdePlugin
float movementdivisor = 1f;
//Ubit change divisions into multiplications below
if (!m_alwaysRun)
- {
movementdivisor = 1 / walkDivisor;
- }
else
- {
movementdivisor = 1 / runDivisor;
- }
+ //******************************************
// colide with land
-
d.AABB aabb;
d.GeomGetAABB(Shell, out aabb);
float chrminZ = aabb.MinZ;
@@ -856,26 +867,6 @@ namespace OpenSim.Region.Physics.OdePlugin
else
vec.Z = depth * PID_P * 30;
- /*
- Vector3 vtmp;
- vtmp.X = _target_velocity.X * timeStep;
- vtmp.Y = _target_velocity.Y * timeStep;
- // fake and avoid squares
- float k = (Math.Abs(vtmp.X) + Math.Abs(vtmp.Y));
- if (k > 0)
- {
- posch.X += vtmp.X;
- posch.Y += vtmp.Y;
- terrainheight -= _parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y);
- k = 1 + Math.Abs(terrainheight) / k;
- movementdivisor /= k;
-
- if (k < 1)
- k = 1;
- }
- */
-
-
if (depth < 0.1f)
{
m_iscolliding = true;
@@ -901,6 +892,7 @@ namespace OpenSim.Region.Physics.OdePlugin
else
m_iscollidingGround = false;
+ //******************************************
// if velocity is zero, use position control; otherwise, velocity control
if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f
@@ -1012,97 +1004,31 @@ namespace OpenSim.Region.Physics.OdePlugin
// _parent_scene.RemoveCharacter(this);
// destroy avatar capsule and related ODE data
AvatarGeomAndBodyDestroy();
+ return;
}
+
+ // update our local ideia of position velocity and aceleration
+ _position = localpos;
+ _acceleration = _velocity; // previus velocity
+ _velocity = vel;
+ _acceleration = (vel - _acceleration) / timeStep;
+
}
///
- /// Updates the reported position and velocity. This essentially sends the data up to ScenePresence.
+ /// Updates the reported position and velocity.
+ /// Used to copy variables from unmanaged space at heartbeat rate and also trigger scene updates acording
+ /// also outbounds checking
+ /// copy and outbounds now done in move(..) at ode rate
+ ///
///
public void UpdatePositionAndVelocity()
{
- // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
- if (Body == IntPtr.Zero)
- return;
+ return;
- d.Vector3 vec;
- try
- {
- d.BodyCopyPosition(Body, out vec);
- }
- catch (NullReferenceException)
- {
- bad = true;
- _parent_scene.BadCharacter(this);
- vec = new d.Vector3(_position.X, _position.Y, _position.Z);
- base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
- m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid);
- }
-
- _position.X = vec.X;
- _position.Y = vec.Y;
- _position.Z = vec.Z;
-
- bool fixbody = false;
-
- if (_position.X < 0.0f)
- {
- fixbody = true;
- _position.X = 0.1f;
- }
- else if (_position.X > (int)_parent_scene.WorldExtents.X - 0.1f)
- {
- fixbody = true;
- _position.X = (int)_parent_scene.WorldExtents.X - 0.1f;
- }
-
- if (_position.Y < 0.0f)
- {
- fixbody = true;
- _position.Y = 0.1f;
- }
- else if (_position.Y > (int)_parent_scene.WorldExtents.Y - 0.1)
- {
- fixbody = true;
- _position.Y = (int)_parent_scene.WorldExtents.Y - 0.1f;
- }
+// if (Body == IntPtr.Zero)
+// return;
- if (fixbody)
- d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
-
- // Did we move last? = zeroflag
- // This helps keep us from sliding all over
-/*
- if (_zeroFlag)
- {
- _velocity.X = 0.0f;
- _velocity.Y = 0.0f;
- _velocity.Z = 0.0f;
-
- // Did we send out the 'stopped' message?
- if (!m_lastUpdateSent)
- {
- m_lastUpdateSent = true;
- base.RequestPhysicsterseUpdate();
- }
- }
- else
- {
- m_lastUpdateSent = false;
- */
- try
- {
- vec = d.BodyGetLinearVel(Body);
- }
- catch (NullReferenceException)
- {
- vec.X = _velocity.X;
- vec.Y = _velocity.Y;
- vec.Z = _velocity.Z;
- }
- _velocity.X = (vec.X);
- _velocity.Y = (vec.Y);
- _velocity.Z = (vec.Z);
- // }
}
///
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 837eae3..9ca2d3f 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -1861,6 +1861,9 @@ namespace OpenSim.Region.Physics.OdePlugin
statstart = Util.EnvironmentTickCount();
+/*
+// now included in characters move() and done at ode rate
+// maybe be needed later if we need to do any extra work at hearbeat rate
lock (_characters)
{
foreach (OdeCharacter actor in _characters)
@@ -1874,7 +1877,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
}
-
+*/
lock (_badCharacter)
{
if (_badCharacter.Count > 0)
--
cgit v1.1
From 9464fcebcd9f0a9b1846113e8aff56ea3f49ace2 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Apr 2012 16:49:08 +0100
Subject: ubitODE: prims - update managed dinamic parameters from unmanaged at
ODE rate and not heartbeat.
---
OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 124 +++++++++---------------
1 file changed, 46 insertions(+), 78 deletions(-)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 32c4722..5467b9f 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -3228,17 +3228,13 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (!childPrim && m_isphysical && Body != IntPtr.Zero &&
!m_disabled && !m_isSelected && !m_building && !m_outbounds)
- // !m_disabled && !m_isSelected && !m_building && !m_outbounds)
{
- // if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); // KF add 161009
-
if (d.BodyIsEnabled(Body))
{
float timestep = _parent_scene.ODE_STEPSIZE;
// check outside region
- d.Vector3 lpos;
- d.GeomCopyPosition(prim_geom, out lpos); // root position that is seem by rest of simulator
+ d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
if (lpos.Z < -100 || lpos.Z > 100000f)
{
@@ -3321,12 +3317,9 @@ namespace OpenSim.Region.Physics.OdePlugin
{
// 'VEHICLES' are dealt with in ODEDynamics.cs
m_vehicle.Step();
- return;
}
-
else
{
-
float fx = 0;
float fy = 0;
float fz = 0;
@@ -3512,10 +3505,39 @@ namespace OpenSim.Region.Physics.OdePlugin
{
d.BodyAddTorque(Body, trq.X, trq.Y, trq.Z);
}
-
}
+
+ // update our ideia of velocities and acelerations
+ d.Quaternion ori;
+ d.Vector3 dtmpu;
+
+ _position.X = lpos.X;
+ _position.Y = lpos.Y;
+ _position.Z = lpos.Z;
+
+ d.GeomCopyQuaternion(prim_geom, out ori);
+ _orientation.X = ori.X;
+ _orientation.Y = ori.Y;
+ _orientation.Z = ori.Z;
+ _orientation.W = ori.W;
+
+ _acceleration = _velocity;
+
+ dtmpu = d.BodyGetLinearVel(Body);
+ _velocity.X = dtmpu.X;
+ _velocity.Y = dtmpu.Y;
+ _velocity.Z = dtmpu.Z;
+
+ float invts = 1 / timestep;
+ _acceleration = (_velocity - _acceleration) * invts;
+
+ dtmpu = d.BodyGetAngularVel(Body);
+ m_rotationalVelocity.X = dtmpu.X;
+ m_rotationalVelocity.Y = dtmpu.Y;
+ m_rotationalVelocity.Z = dtmpu.Z;
}
- else // body disabled
+
+ else // body disabled/sleeping
{
// let vehicles sleep
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
@@ -3546,36 +3568,23 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (Body != IntPtr.Zero)
{
- Vector3 pv = Vector3.Zero;
bool lastZeroFlag = _zeroFlag;
- d.Vector3 lpos;
- d.GeomCopyPosition(prim_geom, out lpos); // root position that is seem by rest of simulator
-
-
- d.Quaternion ori;
- d.GeomCopyQuaternion(prim_geom, out ori);
- d.Vector3 vel = d.BodyGetLinearVel(Body);
- d.Vector3 rotvel = d.BodyGetAngularVel(Body);
-
- if ((Math.Abs(m_lastposition.X - lpos.X) < 0.01)
- && (Math.Abs(m_lastposition.Y - lpos.Y) < 0.01)
- && (Math.Abs(m_lastposition.Z - lpos.Z) < 0.01)
- && (Math.Abs(m_lastorientation.X - ori.X) < 0.0001)
- && (Math.Abs(m_lastorientation.Y - ori.Y) < 0.0001)
- && (Math.Abs(m_lastorientation.Z - ori.Z) < 0.0001)
+ if ((Math.Abs(m_lastposition.X - _position.X) < 0.01)
+ && (Math.Abs(m_lastposition.Y - _position.Y) < 0.01)
+ && (Math.Abs(m_lastposition.Z - _position.Z) < 0.01)
+ && (Math.Abs(m_lastorientation.X - _orientation.X) < 0.0001)
+ && (Math.Abs(m_lastorientation.Y - _orientation.Y) < 0.0001)
+ && (Math.Abs(m_lastorientation.Z - _orientation.Z) < 0.0001)
)
{
_zeroFlag = true;
- //Console.WriteLine("ZFT 2");
m_throttleUpdates = false;
}
else
{
- //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString());
_zeroFlag = false;
m_lastUpdateSent = false;
- //m_throttleUpdates = false;
}
if (_zeroFlag)
@@ -3583,22 +3592,14 @@ namespace OpenSim.Region.Physics.OdePlugin
m_lastposition = _position;
m_lastorientation = _orientation;
- _velocity.X = 0.0f;
- _velocity.Y = 0.0f;
- _velocity.Z = 0.0f;
+ _velocity = Vector3.Zero;
+ _acceleration = Vector3.Zero;
+ m_rotationalVelocity = Vector3.Zero;
- _acceleration.X = 0;
- _acceleration.Y = 0;
- _acceleration.Z = 0;
-
- m_rotationalVelocity.X = 0;
- m_rotationalVelocity.Y = 0;
- m_rotationalVelocity.Z = 0;
if (!m_lastUpdateSent)
{
m_throttleUpdates = false;
throttleCounter = 0;
- m_rotationalVelocity = pv;
base.RequestPhysicsterseUpdate();
@@ -3612,39 +3613,12 @@ namespace OpenSim.Region.Physics.OdePlugin
base.RequestPhysicsterseUpdate();
}
- m_lastVelocity = _velocity;
-
- _position.X = lpos.X;
- _position.Y = lpos.Y;
- _position.Z = lpos.Z;
-
- _velocity.X = vel.X;
- _velocity.Y = vel.Y;
- _velocity.Z = vel.Z;
-
- _orientation.X = ori.X;
- _orientation.Y = ori.Y;
- _orientation.Z = ori.Z;
- _orientation.W = ori.W;
-
- _acceleration = ((_velocity - m_lastVelocity) / simulatedtime);
-
- if (m_rotationalVelocity.ApproxEquals(pv, 0.0001f))
- {
- m_rotationalVelocity = pv;
- }
- else
- {
- m_rotationalVelocity.X = rotvel.X;
- m_rotationalVelocity.Y = rotvel.Y;
- m_rotationalVelocity.Z = rotvel.Z;
- }
-
m_lastUpdateSent = false;
if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate)
{
m_lastposition = _position;
m_lastorientation = _orientation;
+ m_lastVelocity = _velocity;
base.RequestPhysicsterseUpdate();
}
else
@@ -3656,17 +3630,11 @@ namespace OpenSim.Region.Physics.OdePlugin
else if (!m_lastUpdateSent || !_zeroFlag)
{
// Not a body.. so Make sure the client isn't interpolating
- _velocity.X = 0;
- _velocity.Y = 0;
- _velocity.Z = 0;
-
- _acceleration.X = 0;
- _acceleration.Y = 0;
- _acceleration.Z = 0;
+ _velocity = Vector3.Zero;
+ _acceleration = Vector3.Zero;
+ m_rotationalVelocity = Vector3.Zero;
+ m_lastVelocity = Vector3.Zero;
- m_rotationalVelocity.X = 0;
- m_rotationalVelocity.Y = 0;
- m_rotationalVelocity.Z = 0;
_zeroFlag = true;
if (!m_lastUpdateSent)
--
cgit v1.1
From 0fe0b2ceec2440ff284d7a494d090ce43449fd97 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 17 Apr 2012 23:39:41 +0200
Subject: Prevent objects rezzed in sim from being seen as attachments and
becoming uneditable or crashers. (Foxtail of death)
---
.../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 2 ++
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 74701a5..f41e89e 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -768,6 +768,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
g.RootPart.AttachPoint = g.RootPart.Shape.State;
g.RootPart.AttachOffset = g.AbsolutePosition;
+ g.RootPart.Shape.State = 0;
}
objlist.Add(g);
@@ -800,6 +801,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
g.RootPart.AttachPoint = g.RootPart.Shape.State;
g.RootPart.AttachOffset = g.AbsolutePosition;
+ g.RootPart.Shape.State = 0;
objlist.Add(g);
XmlElement el = (XmlElement)n;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3fd1f5e..47020af 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1941,6 +1941,12 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE]: Storing {0}, {1} in {2}",
// Name, UUID, m_scene.RegionInfo.RegionName);
+ if (RootPart.Shape.PCode == 9 && RootPart.Shape.State != 0)
+ {
+ RootPart.Shape.State = 0;
+ ScheduleGroupForFullUpdate();
+ }
+
SceneObjectGroup backup_group = Copy(false);
backup_group.RootPart.Velocity = RootPart.Velocity;
backup_group.RootPart.Acceleration = RootPart.Acceleration;
--
cgit v1.1
From 7f420692958e05f9e2277911627b730c3066ae70 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 18 Apr 2012 03:02:28 +0100
Subject: ubitODE - retouch character PIDs
---
OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index b9ec6b5..b28bc4a 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -683,7 +683,7 @@ namespace OpenSim.Region.Physics.OdePlugin
PID_D *= m_mass / _parent_scene.ODE_STEPSIZE;
PID_P /= 50 * 80;
PID_P *= m_mass / _parent_scene.ODE_STEPSIZE;
-
+
Body = d.BodyCreate(_parent_scene.world);
d.BodySetAutoDisableFlag(Body, false);
@@ -862,10 +862,10 @@ namespace OpenSim.Region.Physics.OdePlugin
float depth = terrainheight - chrminZ;
if (!flying)
{
- vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 30;
+ vec.Z = -vel.Z * PID_D * 3f + depth * PID_P * 60;
}
else
- vec.Z = depth * PID_P * 30;
+ vec.Z = depth * PID_P * 60;
if (depth < 0.1f)
{
@@ -1171,7 +1171,7 @@ namespace OpenSim.Region.Physics.OdePlugin
CAPSULE_LENGTH = caplen;
AvatarGeomAndBodyCreation(_position.X, _position.Y,
- _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2));
+ _position.Z + (CAPSULE_LENGTH - prevCapsule) * 0.5f);
Velocity = Vector3.Zero;
--
cgit v1.1
From 08714a0d3826acee9f0e0bfa278efe97206dce18 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 18 Apr 2012 03:59:38 +0100
Subject: ubitODE still retouching character pid
---
OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index b28bc4a..ec4be58 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -862,12 +862,12 @@ namespace OpenSim.Region.Physics.OdePlugin
float depth = terrainheight - chrminZ;
if (!flying)
{
- vec.Z = -vel.Z * PID_D * 3f + depth * PID_P * 60;
+ vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 60;
}
else
vec.Z = depth * PID_P * 60;
- if (depth < 0.1f)
+ if (depth < 0.2f)
{
m_iscolliding = true;
m_colliderfilter = 2;
--
cgit v1.1
From 5936e0c3760922e09099b65e3db522055db2286c Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 18 Apr 2012 19:51:27 +0200
Subject: Allow scripts in attachments owned by the NPC to control the NPC
---
OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 68f21c8..ebf5e84 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -323,9 +323,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
NPCAvatar av;
if (m_avatars.TryGetValue(npcID, out av))
+ {
+ if (npcID == callerID)
+ return true;
return CheckPermissions(av, callerID);
+ }
else
+ {
return false;
+ }
}
}
@@ -337,7 +343,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
/// true if they do, false if they don't.
private bool CheckPermissions(NPCAvatar av, UUID callerID)
{
- return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID;
+ return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID;
}
}
}
--
cgit v1.1
From 411bd0574d371315c0134b30f1984fc035d84272 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 18 Apr 2012 22:16:59 +0200
Subject: Allow setting a specific target velocity on TeleportWithMomentum
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8ac09e9..1211792 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1076,6 +1076,11 @@ namespace OpenSim.Region.Framework.Scenes
public void TeleportWithMomentum(Vector3 pos)
{
+ TeleportWithMomentum(pos, null);
+ }
+
+ public void TeleportWithMomentum(Vector3 pos, Vector3? v)
+ {
bool isFlying = Flying;
Vector3 vel = Velocity;
RemoveFromPhysicalScene();
@@ -1083,7 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = pos;
AddToPhysicalScene(isFlying);
if (PhysicsActor != null)
- PhysicsActor.SetMomentum(vel);
+ {
+ if (v.HasValue)
+ PhysicsActor.SetMomentum((Vector3)v);
+ else
+ PhysicsActor.SetMomentum(vel);
+ }
SendTerseUpdateToAllClients();
}
--
cgit v1.1
From aeb5aed5b70bbe9c54ec7647a70f8fca7d0aee7e Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Apr 2012 23:01:22 +0100
Subject: changed - VolumeDetect and phantom setting interaction. Script
VD(true) forces phantom ON. UI phantom off turns off VD. Other transitions
should only change specific parameter. This is not as current SL. - Fixed
volumedetect prims being wrongly removed from physics.
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 14 ++++++--
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 39 ++++++++++++++++------
2 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index cd4bd42..b7dc335 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1516,8 +1516,18 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{
// VolumeDetect can't be set via UI and will always be off when a change is made there
- if (PhysData.PhysShapeType == PhysShapeType.invalid)
- group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false);
+ // now only change volume dtc if phantom off
+
+ if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
+ {
+ bool vdtc;
+ if (SetPhantom) // if phantom keep volumedtc
+ vdtc = group.RootPart.VolumeDetectActive;
+ else // else turn it off
+ vdtc = false;
+
+ group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc);
+ }
else
{
SceneObjectPart part = GetSceneObjectPart(localID);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 511ab19..c73fc98 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1830,7 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building)
{
- VolumeDetectActive = _VolumeDetectActive; //?? as is used this is redundante
+ VolumeDetectActive = _VolumeDetectActive;
if (!ParentGroup.Scene.CollidablePrims)
return;
@@ -1839,7 +1839,10 @@ namespace OpenSim.Region.Framework.Scenes
return;
bool isPhysical = (_ObjectFlags & (uint) PrimFlags.Physics) != 0;
- bool isPhantom = (_ObjectFlags & (uint) PrimFlags.Phantom) != 0;
+ bool isPhantom = (_ObjectFlags & (uint)PrimFlags.Phantom) != 0;
+
+ if (_VolumeDetectActive)
+ isPhantom = true;
if (IsJoint())
{
@@ -2065,6 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Do a physics propery update for this part.
+ /// now also updates phantom and volume detector
///
///
///
@@ -2096,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup.RootPart == this)
AngularVelocity = new Vector3(0, 0, 0);
- if (pa.Phantom)
+ if (pa.Phantom && !VolumeDetectActive)
{
RemoveFromPhysics();
return;
@@ -2143,6 +2147,14 @@ namespace OpenSim.Region.Framework.Scenes
if (pa.Phantom != phan)
pa.Phantom = phan;
+// some engines dont' have this check still
+// if (VolumeDetectActive != pa.IsVolumeDtc)
+ {
+ if (VolumeDetectActive)
+ pa.SetVolumeDetect(1);
+ else
+ pa.SetVolumeDetect(0);
+ }
// If this part is a sculpt then delay the physics update until we've asynchronously loaded the
// mesh data.
@@ -4599,6 +4611,12 @@ namespace OpenSim.Region.Framework.Scenes
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
return;
+ VolumeDetectActive = SetVD;
+
+ // volume detector implies phantom
+ if (VolumeDetectActive)
+ SetPhantom = true;
+
if (UsePhysics)
AddFlag(PrimFlags.Physics);
else
@@ -4614,7 +4632,6 @@ namespace OpenSim.Region.Framework.Scenes
else
RemFlag(PrimFlags.TemporaryOnRez);
- VolumeDetectActive = SetVD;
if (ParentGroup.Scene == null)
return;
@@ -4624,7 +4641,7 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null && building && pa.Building != building)
pa.Building = building;
- if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none
+ if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none
|| (Shape.PathCurve == (byte)Extrusion.Flexible))
{
if (pa != null)
@@ -4669,12 +4686,12 @@ namespace OpenSim.Region.Framework.Scenes
else // it already has a physical representation
{
DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
-
- if(VolumeDetectActive)
- pa.SetVolumeDetect(1);
- else
- pa.SetVolumeDetect(0);
-
+ /* moved into DoPhysicsPropertyUpdate
+ if(VolumeDetectActive)
+ pa.SetVolumeDetect(1);
+ else
+ pa.SetVolumeDetect(0);
+ */
if (pa.Building != building)
pa.Building = building;
}
--
cgit v1.1