Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
avinationmerge
Melanie 2011-12-22 16:37:25 +00:00
commit b970d4f976
13 changed files with 153 additions and 171 deletions

View File

@ -1181,9 +1181,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// DateTime startTime = DateTime.Now; // DateTime startTime = DateTime.Now;
// m_log.DebugFormat( m_log.DebugFormat(
// "[SCENE PRESENCE]: Completing movement of {0} into region {1}", "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
// client.Name, Scene.RegionInfo.RegionName); client.Name, Scene.RegionInfo.RegionName, AbsolutePosition);
Vector3 look = Velocity; Vector3 look = Velocity;
if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@ -2405,9 +2405,7 @@ namespace OpenSim.Region.Framework.Scenes
m_lastVelocity = Velocity; m_lastVelocity = Velocity;
} }
// followed suggestion from mic bowman. reversed the two lines below. CheckForBorderCrossing();
if (ParentID == 0 && PhysicsActor != null || ParentID != 0) // Check that we have a physics actor or we're sitting on something
CheckForBorderCrossing();
CheckForSignificantMovement(); // sends update to the modules. CheckForSignificantMovement(); // sends update to the modules.
} }
@ -2760,145 +2758,142 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks> /// </remarks>
protected void CheckForBorderCrossing() protected void CheckForBorderCrossing()
{ {
// Check that we we are not a child
if (IsChildAgent) if (IsChildAgent)
return; return;
if (ParentID != 0) if (ParentID != 0)
return; return;
Vector3 pos2 = AbsolutePosition;
Vector3 vel = Velocity;
int neighbor = 0;
int[] fix = new int[2];
float timeStep = 0.1f;
pos2.X = pos2.X + (vel.X*timeStep);
pos2.Y = pos2.Y + (vel.Y*timeStep);
pos2.Z = pos2.Z + (vel.Z*timeStep);
if (!IsInTransit) if (!IsInTransit)
{ {
// Checks if where it's headed exists a region Vector3 pos2 = AbsolutePosition;
Vector3 vel = Velocity;
int neighbor = 0;
int[] fix = new int[2];
bool needsTransit = false; float timeStep = 0.1f;
if (m_scene.TestBorderCross(pos2, Cardinals.W))
{
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
}
else
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.E))
{
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
}
else
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
}
// Makes sure avatar does not end up outside region
if (neighbor <= 0)
{
if (needsTransit)
{
if (m_requestedSitTargetUUID == UUID.Zero)
{
bool isFlying = Flying;
RemoveFromPhysicalScene();
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.X * 2;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.X * 2;
if (AbsolutePosition.Y < 0)
pos.Y += Velocity.Y * 2;
else if (AbsolutePosition.Y > Constants.RegionSize)
pos.Y -= Velocity.Y * 2;
Velocity = Vector3.Zero;
AbsolutePosition = pos;
// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
AddToPhysicalScene(isFlying);
}
}
}
else if (neighbor > 0)
{
if (!CrossToNewRegion())
{
if (m_requestedSitTargetUUID == UUID.Zero)
{
bool isFlying = Flying;
RemoveFromPhysicalScene();
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.X * 2;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.X * 2;
if (AbsolutePosition.Y < 0)
pos.Y += Velocity.Y * 2;
else if (AbsolutePosition.Y > Constants.RegionSize)
pos.Y -= Velocity.Y * 2;
Velocity = Vector3.Zero;
AbsolutePosition = pos;
AddToPhysicalScene(isFlying);
}
}
}
}
else
{
// We must remove the agent from the physical scene if it has been placed in transit. If we don't,
// then this method continues to be called from ScenePresence.Update() until the handover of the client between
// regions is completed. Since this handover can take more than 1000ms (due to the 1000ms
// event queue polling response from the server), this results in the avatar pausing on the border
// for the handover period.
RemoveFromPhysicalScene();
// This constant has been inferred from experimentation
// I'm not sure what this value should be, so I tried a few values.
timeStep = 0.04f;
pos2 = AbsolutePosition;
pos2.X = pos2.X + (vel.X * timeStep); pos2.X = pos2.X + (vel.X * timeStep);
pos2.Y = pos2.Y + (vel.Y * timeStep); pos2.Y = pos2.Y + (vel.Y * timeStep);
pos2.Z = pos2.Z + (vel.Z * timeStep); pos2.Z = pos2.Z + (vel.Z * timeStep);
m_pos = pos2;
if (!IsInTransit)
{
// Checks if where it's headed exists a region
bool needsTransit = false;
if (m_scene.TestBorderCross(pos2, Cardinals.W))
{
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
}
else
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.E))
{
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
}
else
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
}
// Makes sure avatar does not end up outside region
if (neighbor <= 0)
{
if (needsTransit)
{
if (m_requestedSitTargetUUID == UUID.Zero)
{
bool isFlying = Flying;
RemoveFromPhysicalScene();
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.X * 2;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.X * 2;
if (AbsolutePosition.Y < 0)
pos.Y += Velocity.Y * 2;
else if (AbsolutePosition.Y > Constants.RegionSize)
pos.Y -= Velocity.Y * 2;
Velocity = Vector3.Zero;
AbsolutePosition = pos;
m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
AddToPhysicalScene(isFlying);
}
}
}
else if (neighbor > 0)
{
if (!CrossToNewRegion())
{
if (m_requestedSitTargetUUID == UUID.Zero)
{
bool isFlying = Flying;
RemoveFromPhysicalScene();
Vector3 pos = AbsolutePosition;
if (AbsolutePosition.X < 0)
pos.X += Velocity.X * 2;
else if (AbsolutePosition.X > Constants.RegionSize)
pos.X -= Velocity.X * 2;
if (AbsolutePosition.Y < 0)
pos.Y += Velocity.Y * 2;
else if (AbsolutePosition.Y > Constants.RegionSize)
pos.Y -= Velocity.Y * 2;
Velocity = Vector3.Zero;
AbsolutePosition = pos;
AddToPhysicalScene(isFlying);
}
}
}
}
else
{
// This constant has been inferred from experimentation
// I'm not sure what this value should be, so I tried a few values.
timeStep = 0.04f;
pos2 = AbsolutePosition;
pos2.X = pos2.X + (vel.X * timeStep);
pos2.Y = pos2.Y + (vel.Y * timeStep);
// Don't touch the Z
m_pos = pos2;
m_log.DebugFormat("[SCENE PRESENCE]: In transit m_pos={0}", m_pos);
}
} }
} }

View File

@ -233,6 +233,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return _acceleration; } get { return _acceleration; }
set { _acceleration = value; }
} }
public override bool Kinematic public override bool Kinematic
@ -253,11 +254,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{ {
} }
public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
public override void AddForce(Vector3 force, bool pushforce) public override void AddForce(Vector3 force, bool pushforce)
{ {
} }

View File

@ -232,6 +232,7 @@ public class BSCharacter : PhysicsActor
} }
public override Vector3 Acceleration { public override Vector3 Acceleration {
get { return _acceleration; } get { return _acceleration; }
set { _acceleration = value; }
} }
public override Quaternion Orientation { public override Quaternion Orientation {
get { return _orientation; } get { return _orientation; }

View File

@ -418,6 +418,7 @@ public sealed class BSPrim : PhysicsActor
} }
public override OMV.Vector3 Acceleration { public override OMV.Vector3 Acceleration {
get { return _acceleration; } get { return _acceleration; }
set { _acceleration = value; }
} }
public override OMV.Quaternion Orientation { public override OMV.Quaternion Orientation {
get { return _orientation; } get { return _orientation; }

View File

@ -261,7 +261,7 @@ namespace OpenSim.Region.Physics.Manager
public abstract Vector3 Torque { get; set; } public abstract Vector3 Torque { get; set; }
public abstract float CollisionScore { get; set;} public abstract float CollisionScore { get; set;}
public abstract Vector3 Acceleration { get; } public abstract Vector3 Acceleration { get; set; }
public abstract Quaternion Orientation { get; set; } public abstract Quaternion Orientation { get; set; }
public abstract int PhysicsActorType { get; set; } public abstract int PhysicsActorType { get; set; }
public abstract bool IsPhysical { get; set; } public abstract bool IsPhysical { get; set; }
@ -458,6 +458,7 @@ namespace OpenSim.Region.Physics.Manager
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return Vector3.Zero; } get { return Vector3.Zero; }
set { }
} }
public override bool IsPhysical public override bool IsPhysical

View File

@ -690,12 +690,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return _acceleration; } get { return _acceleration; }
} set { _acceleration = value; }
public void SetAcceleration(Vector3 accel)
{
m_pidControllerActive = true;
_acceleration = accel;
} }
/// <summary> /// <summary>

View File

@ -2497,6 +2497,7 @@ Console.WriteLine(" JointCreateFixed");
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return _acceleration; } get { return _acceleration; }
set { _acceleration = value; }
} }
public override void AddForce(Vector3 force, bool pushforce) public override void AddForce(Vector3 force, bool pushforce)

View File

@ -231,6 +231,7 @@ namespace OpenSim.Region.Physics.POSPlugin
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return _acceleration; } get { return _acceleration; }
set { _acceleration = value; }
} }
public override bool Kinematic public override bool Kinematic
@ -251,11 +252,6 @@ namespace OpenSim.Region.Physics.POSPlugin
{ {
} }
public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
public override void AddForce(Vector3 force, bool pushforce) public override void AddForce(Vector3 force, bool pushforce)
{ {
} }

View File

@ -193,6 +193,7 @@ namespace OpenSim.Region.Physics.POSPlugin
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return _acceleration; } get { return _acceleration; }
set { _acceleration = value; }
} }
public override bool Kinematic public override bool Kinematic
@ -201,11 +202,6 @@ namespace OpenSim.Region.Physics.POSPlugin
set { } set { }
} }
public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
}
public override void AddForce(Vector3 force, bool pushforce) public override void AddForce(Vector3 force, bool pushforce)
{ {
} }

View File

@ -233,11 +233,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return _acceleration; } get { return _acceleration; }
} set { _acceleration = value; }
public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
} }
public override void AddForce(Vector3 force, bool pushforce) public override void AddForce(Vector3 force, bool pushforce)

View File

@ -207,11 +207,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public override Vector3 Acceleration public override Vector3 Acceleration
{ {
get { return _acceleration; } get { return _acceleration; }
} set { _acceleration = value; }
public void SetAcceleration(Vector3 accel)
{
_acceleration = accel;
} }
public override void AddForce(Vector3 force, bool pushforce) public override void AddForce(Vector3 force, bool pushforce)

View File

@ -161,6 +161,14 @@ namespace OpenSim.Services.HypergridService
{ {
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null)
{
m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
reason = "Forbidden to launch your agents from here";
return false;
}
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
GridRegion region = new GridRegion(gatekeeper); GridRegion region = new GridRegion(gatekeeper);
region.ServerURI = gatekeeper.ServerURI; region.ServerURI = gatekeeper.ServerURI;