Merge branch 'master' into bigmerge

Conflicts:
	OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
avinationmerge
Melanie 2011-10-30 10:16:25 +00:00
commit 083b28de8c
11 changed files with 129 additions and 139 deletions

View File

@ -4925,8 +4925,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
data.CollisionPlane.ToBytes(objectData, 0);
data.OffsetPosition.ToBytes(objectData, 16);
//data.Velocity.ToBytes(objectData, 28);
//data.Acceleration.ToBytes(objectData, 40);
// data.Velocity.ToBytes(objectData, 28);
// data.Acceleration.ToBytes(objectData, 40);
data.Rotation.ToBytes(objectData, 52);
//data.AngularVelocity.ToBytes(objectData, 64);

View File

@ -1712,7 +1712,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Offset the positions for the new region across the border
Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
grp.OffsetForNewRegion(pos);
grp.RootPart.GroupPosition = pos;
// If we fail to cross the border, then reset the position of the scene object on that border.
uint x = 0, y = 0;
@ -1720,7 +1720,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
{
grp.OffsetForNewRegion(oldGroupPosition);
grp.RootPart.GroupPosition = oldGroupPosition;
grp.ScheduleGroupForFullUpdate();
}
}

View File

@ -528,12 +528,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// This gets locked so things stay thread safe.
public object SyncRoot
{
get { return m_sceneGraph.m_syncRoot; }
}
public string DefaultScriptEngine
{
get { return m_defaultScriptEngine; }

View File

@ -93,8 +93,6 @@ namespace OpenSim.Region.Framework.Scenes
protected int m_activeScripts = 0;
protected int m_scriptLPS = 0;
protected internal object m_syncRoot = new object();
protected internal PhysicsScene _PhyScene;
/// <summary>
@ -200,8 +198,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="elapsed"></param>
/// <returns></returns>
protected internal float UpdatePhysics(double elapsed)
{
lock (m_syncRoot)
{
// Here is where the Scene calls the PhysicsScene. This is a one-way
// interaction; the PhysicsScene cannot access the calling Scene directly.
@ -218,10 +214,8 @@ namespace OpenSim.Region.Framework.Scenes
// position).
//
// Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate().
return _PhyScene.Simulate((float)elapsed);
}
}
protected internal void UpdateScenePresenceMovement()
{

View File

@ -344,15 +344,15 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_parts.Count; }
}
protected Quaternion m_rotation = Quaternion.Identity;
public virtual Quaternion Rotation
{
get { return m_rotation; }
set {
m_rotation = value;
}
}
// protected Quaternion m_rotation = Quaternion.Identity;
//
// public virtual Quaternion Rotation
// {
// get { return m_rotation; }
// set {
// m_rotation = value;
// }
// }
public Quaternion GroupRotation
{
@ -3216,17 +3216,12 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void OffsetForNewRegion(Vector3 offset)
{
m_rootPart.GroupPosition = offset;
}
#endregion
#region Rotation
/// <summary>
///
/// Update the rotation of the group.
/// </summary>
/// <param name="rot"></param>
public void UpdateGroupRotationR(Quaternion rot)
@ -3254,7 +3249,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
///
/// Update the position and rotation of a group simultaneously.
/// </summary>
/// <param name="pos"></param>
/// <param name="rot"></param>
@ -3288,7 +3283,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
///
/// Update the rotation of a single prim within the group.
/// </summary>
/// <param name="rot"></param>
/// <param name="localID"></param>
@ -3314,7 +3309,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
///
/// Update the position and rotation simultaneously of a single prim within the group.
/// </summary>
/// <param name="rot"></param>
/// <param name="localID"></param>
@ -3355,7 +3350,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
///
/// Update the entire rotation of the group.
/// </summary>
/// <param name="rot"></param>
public void UpdateRootRotation(Quaternion rot)

View File

@ -822,6 +822,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// float roll, pitch, yaw = 0;
// m_rotationOffset.GetEulerAngles(out roll, out pitch, out yaw);
//
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Got euler {0} for RotationOffset on {1} {2}",
// new Vector3(roll, pitch, yaw), Name, LocalId);
return m_rotationOffset;
}
@ -858,6 +865,13 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
}
}
// float roll, pitch, yaw = 0;
// m_rotationOffset.GetEulerAngles(out roll, out pitch, out yaw);
//
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Set euler {0} for RotationOffset on {1} {2}",
// new Vector3(roll, pitch, yaw), Name, LocalId);
}
}
@ -4548,12 +4562,13 @@ namespace OpenSim.Region.Framework.Scenes
PhysActor = null;
}
/// <summary>
/// This updates the part's rotation and sends out an update to clients if necessary.
/// </summary>
/// <param name="rot"></param>
public void UpdateRotation(Quaternion rot)
{
if ((rot.X != RotationOffset.X) ||
(rot.Y != RotationOffset.Y) ||
(rot.Z != RotationOffset.Z) ||
(rot.W != RotationOffset.W))
if (rot != RotationOffset)
{
RotationOffset = rot;

View File

@ -548,7 +548,6 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
lock (m_scene.SyncRoot)
PhysicsActor.Position = value;
}
catch (Exception e)
@ -601,7 +600,6 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
lock (m_scene.SyncRoot)
PhysicsActor.Velocity = value;
}
catch (Exception e)

View File

@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
grp2.AbsolutePosition = Vector3.Zero;
// <90,0,0>
grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
// grp1.UpdateGroupRotationR(Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
// <180,0,0>
grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
if (debugtest)
{
m_log.Debug("parts: " + grp1.Parts.Length);
m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation);
m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.GroupRotation);
m_log.Debug("Group1: Prim1: OffsetPosition:"+ part1.OffsetPosition+", OffsetRotation:"+part1.RotationOffset);
m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+part2.RotationOffset);
}
@ -152,13 +152,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
grp4.AbsolutePosition = new Vector3(40, 40, 40);
// <90,0,0>
grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
// grp1.UpdateGroupRotationR(Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
// <180,0,0>
grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
// <270,0,0>
grp3.Rotation = (Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0));
// grp3.UpdateGroupRotationR(Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0));
// <0,90,0>
grp4.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 90 * Utils.DEG_TO_RAD, 0));
@ -187,12 +187,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{
m_log.Debug("--------After Link-------");
m_log.Debug("Group1: parts:" + grp1.Parts.Length);
m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation);
m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.GroupRotation);
m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset);
m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+ part2.RotationOffset);
m_log.Debug("Group3: parts:" + grp3.Parts.Length);
m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation);
m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.GroupRotation);
m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset);
m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset);
}
@ -240,12 +240,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{
m_log.Debug("--------After De-Link-------");
m_log.Debug("Group1: parts:" + grp1.Parts.Length);
m_log.Debug("Group1: Pos:" + grp1.AbsolutePosition + ", Rot:" + grp1.Rotation);
m_log.Debug("Group1: Pos:" + grp1.AbsolutePosition + ", Rot:" + grp1.GroupRotation);
m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset);
m_log.Debug("Group1: Prim2: OffsetPosition:" + part2.OffsetPosition + ", OffsetRotation:" + part2.RotationOffset);
m_log.Debug("Group3: parts:" + grp3.Parts.Length);
m_log.Debug("Group3: Pos:" + grp3.AbsolutePosition + ", Rot:" + grp3.Rotation);
m_log.Debug("Group3: Pos:" + grp3.AbsolutePosition + ", Rot:" + grp3.GroupRotation);
m_log.Debug("Group3: Prim1: OffsetPosition:" + part3.OffsetPosition + ", OffsetRotation:" + part3.RotationOffset);
m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset);
}

View File

@ -74,6 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool _zeroFlag = false;
private bool m_lastUpdateSent = false;
private Vector3 _velocity;
private Vector3 m_taintTargetVelocity;
private Vector3 _target_velocity;
private Vector3 _acceleration;
private Vector3 m_rotationalVelocity;
@ -161,17 +162,19 @@ namespace OpenSim.Region.Physics.OdePlugin
{
pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
}
_position = pos;
m_taintPosition.X = pos.X;
m_taintPosition.Y = pos.Y;
m_taintPosition.Z = pos.Z;
m_taintPosition = pos;
}
else
{
_position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
m_taintPosition.X = _position.X;
m_taintPosition.Y = _position.Y;
m_taintPosition.Z = _position.Z;
_position
= new Vector3(
(float)_parent_scene.WorldExtents.X * 0.5f,
(float)_parent_scene.WorldExtents.Y * 0.5f,
parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
m_taintPosition = _position;
m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
}
@ -431,13 +434,7 @@ namespace OpenSim.Region.Physics.OdePlugin
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
}
_position.X = value.X;
_position.Y = value.Y;
_position.Z = value.Z;
m_taintPosition.X = value.X;
m_taintPosition.Y = value.Y;
m_taintPosition.Z = value.Z;
m_taintPosition = value;
_parent_scene.AddPhysicsActorTaint(this);
}
else
@ -590,10 +587,7 @@ namespace OpenSim.Region.Physics.OdePlugin
_position.Y = npositionY;
_position.Z = npositionZ;
m_taintPosition.X = npositionX;
m_taintPosition.Y = npositionY;
m_taintPosition.Z = npositionZ;
m_taintPosition = _position;
d.BodySetMass(Body, ref ShellMass);
d.Matrix3 m_caprot;
@ -708,7 +702,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
// //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyFArotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
// }
public override Vector3 Force
@ -774,14 +768,15 @@ namespace OpenSim.Region.Physics.OdePlugin
if (value.IsFinite())
{
m_pidControllerActive = true;
_target_velocity = value;
m_taintTargetVelocity = value;
_parent_scene.AddPhysicsActorTaint(this);
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character");
}
// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", _target_velocity);
// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", m_taintTargetVelocity);
}
}
@ -841,16 +836,14 @@ namespace OpenSim.Region.Physics.OdePlugin
// If uncommented, things get pushed off world
//
// m_log.Debug("Push!");
// _target_velocity.X += force.X;
// _target_velocity.Y += force.Y;
// _target_velocity.Z += force.Z;
// m_taintTargetVelocity.X += force.X;
// m_taintTargetVelocity.Y += force.Y;
// m_taintTargetVelocity.Z += force.Z;
}
else
{
m_pidControllerActive = true;
_target_velocity.X += force.X;
_target_velocity.Y += force.Y;
_target_velocity.Z += force.Z;
m_taintTargetVelocity += force;
}
}
else
@ -871,8 +864,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public void doForce(Vector3 force)
{
d.BodyAddForce(Body, force.X, force.Y, force.Z);
//d.BodySetRotation(Body, ref m_StandUpRotation);
//standupStraight();
}
public override void SetMomentum(Vector3 momentum)
@ -1062,69 +1053,66 @@ namespace OpenSim.Region.Physics.OdePlugin
internal void UpdatePositionAndVelocity()
{
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
d.Vector3 vec;
d.Vector3 newPos;
try
{
vec = d.BodyGetPosition(Body);
newPos = d.BodyGetPosition(Body);
}
catch (NullReferenceException)
{
bad = true;
_parent_scene.BadCharacter(this);
vec = new d.Vector3(_position.X, _position.Y, _position.Z);
newPos = 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);
}
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
if (vec.X < 0.0f) vec.X = 0.0f;
if (vec.Y < 0.0f) vec.Y = 0.0f;
if (vec.X > (int)_parent_scene.WorldExtents.X - 0.05f) vec.X = (int)_parent_scene.WorldExtents.X - 0.05f;
if (vec.Y > (int)_parent_scene.WorldExtents.Y - 0.05f) vec.Y = (int)_parent_scene.WorldExtents.Y - 0.05f;
if (newPos.X < 0.0f) newPos.X = 0.0f;
if (newPos.Y < 0.0f) newPos.Y = 0.0f;
if (newPos.X > (int)_parent_scene.WorldExtents.X - 0.05f) newPos.X = (int)_parent_scene.WorldExtents.X - 0.05f;
if (newPos.Y > (int)_parent_scene.WorldExtents.Y - 0.05f) newPos.Y = (int)_parent_scene.WorldExtents.Y - 0.05f;
_position.X = vec.X;
_position.Y = vec.Y;
_position.Z = vec.Z;
_position.X = newPos.X;
_position.Y = newPos.Y;
_position.Z = newPos.Z;
// I think we need to update the taintPosition too -- Diva 12/24/10
m_taintPosition.X = vec.X;
m_taintPosition.Y = vec.Y;
m_taintPosition.Z = vec.Z;
m_taintPosition = _position;
// 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;
_velocity = Vector3.Zero;
// Did we send out the 'stopped' message?
if (!m_lastUpdateSent)
{
m_lastUpdateSent = true;
//base.RequestPhysicsterseUpdate();
}
}
else
{
m_lastUpdateSent = false;
d.Vector3 newVelocity;
try
{
vec = d.BodyGetLinearVel(Body);
newVelocity = d.BodyGetLinearVel(Body);
}
catch (NullReferenceException)
{
vec.X = _velocity.X;
vec.Y = _velocity.Y;
vec.Z = _velocity.Z;
newVelocity.X = _velocity.X;
newVelocity.Y = _velocity.Y;
newVelocity.Z = _velocity.Z;
}
_velocity.X = (vec.X);
_velocity.Y = (vec.Y);
_velocity.Z = (vec.Z);
_velocity.X = newVelocity.X;
_velocity.Y = newVelocity.Y;
_velocity.Z = newVelocity.Z;
if (_velocity.Z < -6 && !m_hackSentFall)
{
@ -1253,6 +1241,18 @@ namespace OpenSim.Region.Physics.OdePlugin
internal void ProcessTaints()
{
if (m_taintPosition != _position)
{
if (Body != IntPtr.Zero)
{
d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z);
_position = m_taintPosition;
}
}
if (m_taintTargetVelocity != _target_velocity)
_target_velocity = m_taintTargetVelocity;
if (m_tainted_isPhysical != m_isPhysical)
{
if (m_tainted_isPhysical)
@ -1294,7 +1294,9 @@ namespace OpenSim.Region.Physics.OdePlugin
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
d.BodyDestroy(Body);
d.GeomDestroy(Shell);
AvatarGeomAndBodyCreation(_position.X, _position.Y,
AvatarGeomAndBodyCreation(
_position.X,
_position.Y,
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
// As with Size, we reset velocity. However, this isn't strictly necessary since it doesn't
@ -1312,18 +1314,6 @@ namespace OpenSim.Region.Physics.OdePlugin
+ (Amotor==IntPtr.Zero ? "Amotor ":""));
}
}
if (!m_taintPosition.ApproxEquals(_position, 0.05f))
{
if (Body != IntPtr.Zero)
{
d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z);
_position.X = m_taintPosition.X;
_position.Y = m_taintPosition.Y;
_position.Z = m_taintPosition.Z;
}
}
}
internal void AddCollisionFrameTime(int p)

View File

@ -550,7 +550,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (World.Entities.TryGetValue(target, out entity))
{
if (entity is SceneObjectGroup)
((SceneObjectGroup)entity).Rotation = rotation;
((SceneObjectGroup)entity).UpdateGroupRotationR(rotation);
else if (entity is ScenePresence)
((ScenePresence)entity).Rotation = rotation;
}

View File

@ -1060,6 +1060,10 @@
AllowGodFunctions = false
; Maximum number of llListen events we allow over the entire region.
; Set this to 0 to have no limit imposed
max_listeners_per_region = 1000
; Maximum number of llListen events we allow per script
; Set this to 0 to have no limit imposed.
max_listens_per_script = 64