Add parameter and code for AgentID to track bucket changes. Added ground collision so walking now works

dsg
Robert Adams 2010-12-21 13:19:09 -08:00
parent e1c3650634
commit a2ca47d7eb
8 changed files with 50 additions and 9 deletions

View File

@ -380,15 +380,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
try try
{ {
uint localID = data["localID"].AsUInteger(); uint localID = data["localID"].AsUInteger();
string actorID = data["actorID"].AsString();
// m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, localID); // m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, localID);
PhysicsActor pa = FindPhysicsActor(localID); PhysicsActor pa = FindPhysicsActor(localID);
if (pa != null) if (pa != null)
{ {
Vector3 sizeTemp = data["size"].AsVector3(); // pa.Size = data["size"].AsVector3();
if (sizeTemp.Z != 0) pa.ChangingActorID = actorID;
{
// pa.Size = sizeTemp;
}
pa.Position = data["position"].AsVector3(); pa.Position = data["position"].AsVector3();
pa.Force = data["force"].AsVector3(); pa.Force = data["force"].AsVector3();
pa.Velocity = data["velocity"].AsVector3(); pa.Velocity = data["velocity"].AsVector3();
@ -439,6 +437,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// m_log.DebugFormat("{0}: SendPhysUpdateAttributes for {1}", LogHeader, pa.LocalID); // m_log.DebugFormat("{0}: SendPhysUpdateAttributes for {1}", LogHeader, pa.LocalID);
OSDMap data = new OSDMap(9); OSDMap data = new OSDMap(9);
data["localID"] = OSD.FromUInteger(pa.LocalID); data["localID"] = OSD.FromUInteger(pa.LocalID);
data["actorID"] = OSD.FromString(RegionSyncServerModule.ActorID);
data["size"] = OSD.FromVector3(pa.Size); data["size"] = OSD.FromVector3(pa.Size);
data["position"] = OSD.FromVector3(pa.Position); data["position"] = OSD.FromVector3(pa.Position);
data["force"] = OSD.FromVector3(pa.Force); data["force"] = OSD.FromVector3(pa.Force);
@ -448,6 +447,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical); data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical);
data["flying"] = OSD.FromBoolean(pa.Flying); data["flying"] = OSD.FromBoolean(pa.Flying);
data["buoyancy"] = OSD.FromReal(pa.Buoyancy); data["buoyancy"] = OSD.FromReal(pa.Buoyancy);
data["isColliding"] = OSD.FromBoolean(pa.IsColliding);
data["isCollidingGround"] = OSD.FromBoolean(pa.CollidingGround);
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.PhysUpdateAttributes, RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.PhysUpdateAttributes,
OSDParser.SerializeJsonString(data)); OSDParser.SerializeJsonString(data));

View File

@ -48,6 +48,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public class RegionSyncServerModule : IRegionModule, IRegionSyncServerModule, ICommandableModule public class RegionSyncServerModule : IRegionModule, IRegionSyncServerModule, ICommandableModule
{ {
private static int DefaultPort = 13000; private static int DefaultPort = 13000;
public static string ActorID = "XX";
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
@ -74,6 +75,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return; return;
} }
// get identifying actor ID whether in client or server mode
ActorID = syncConfig.GetString("ActorID", "ZZ");
// If syncConfig does not indicate "server", do not start up server mode // If syncConfig does not indicate "server", do not start up server mode
string mode = syncConfig.GetString("Mode", "server").ToLower(); string mode = syncConfig.GetString("Mode", "server").ToLower();
if(mode != "server") if(mode != "server")

View File

@ -319,10 +319,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
try try
{ {
uint localID = data["localID"].AsUInteger(); uint localID = data["localID"].AsUInteger();
string actorID = data["actorID"].AsString();
// m_log.DebugFormat("{0}: received PhysUpdateAttributes for {1}", LogHeader, localID); // m_log.DebugFormat("{0}: received PhysUpdateAttributes for {1}", LogHeader, localID);
PhysicsActor pa = FindPhysicsActor(localID); PhysicsActor pa = FindPhysicsActor(localID);
if (pa != null) if (pa != null)
{ {
pa.ChangingActorID = actorID;
pa.Size = data["size"].AsVector3(); pa.Size = data["size"].AsVector3();
pa.Position = data["position"].AsVector3(); pa.Position = data["position"].AsVector3();
pa.Force = data["force"].AsVector3(); pa.Force = data["force"].AsVector3();
@ -333,6 +335,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
pa.Flying = data["flying"].AsBoolean(); // receive?? pa.Flying = data["flying"].AsBoolean(); // receive??
pa.Kinematic = data["kinematic"].AsBoolean(); // receive?? pa.Kinematic = data["kinematic"].AsBoolean(); // receive??
pa.Buoyancy = (float)(data["buoyancy"].AsReal()); pa.Buoyancy = (float)(data["buoyancy"].AsReal());
pa.CollidingGround = data["isCollidingGround"].AsBoolean();
pa.IsColliding = data["isCollidingGround"].AsBoolean();
} }
else else
{ {
@ -369,6 +373,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// m_log.DebugFormat("{0}: sending PhysUpdateAttributes for {1}", LogHeader, pa.LocalID); // m_log.DebugFormat("{0}: sending PhysUpdateAttributes for {1}", LogHeader, pa.LocalID);
OSDMap data = new OSDMap(9); OSDMap data = new OSDMap(9);
data["localID"] = OSD.FromUInteger(pa.LocalID); data["localID"] = OSD.FromUInteger(pa.LocalID);
data["actorID"] = OSD.FromString(RegionSyncServerModule.ActorID);
data["size"] = OSD.FromVector3(pa.Size); data["size"] = OSD.FromVector3(pa.Size);
data["position"] = OSD.FromVector3(pa.Position); data["position"] = OSD.FromVector3(pa.Position);
data["force"] = OSD.FromVector3(pa.Force); data["force"] = OSD.FromVector3(pa.Force);
@ -378,6 +383,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical); data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical);
data["flying"] = OSD.FromBoolean(pa.Flying); data["flying"] = OSD.FromBoolean(pa.Flying);
data["buoyancy"] = OSD.FromReal(pa.Buoyancy); data["buoyancy"] = OSD.FromReal(pa.Buoyancy);
// data["isColliding"] = OSD.FromBoolean(pa.IsColliding);
// data["isCollidingGround"] = OSD.FromBoolean(pa.CollidingGround);
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.PhysUpdateAttributes, RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.PhysUpdateAttributes,
OSDParser.SerializeJsonString(data)); OSDParser.SerializeJsonString(data));

View File

@ -190,6 +190,8 @@ namespace OpenSim.Region.Physics.Manager
get { return m_baseLocalID; } get { return m_baseLocalID; }
} }
public PhysActorLastValues lastValues; public PhysActorLastValues lastValues;
// ID of actor which last updated the values. Send if I did the change.
public string ChangingActorID = "YY";
public abstract bool Grabbed { set; } public abstract bool Grabbed { set; }

View File

@ -208,7 +208,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (PhysEngineToSceneConnectorModule.IsPhysEngineActorS) if (PhysEngineToSceneConnectorModule.IsPhysEngineActorS)
{ {
// m_log.DebugFormat("[ODE CHARACTER]: Sending terse update for {0}", LocalID); // m_log.DebugFormat("[ODE CHARACTER]: Sending terse update for {0}", LocalID);
if (this.lastValues.Changed(this)) // if the values have changed and it was I who changed them, send an update
if (this.lastValues.Changed(this) && ChangingActorID == RegionSyncServerModule.ActorID)
{ {
PhysEngineToSceneConnectorModule.RouteUpdate(this); PhysEngineToSceneConnectorModule.RouteUpdate(this);
} }
@ -426,6 +427,7 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return _position; } get { return _position; }
set set
{ {
base.ChangingActorID = RegionSyncServerModule.ActorID;
if (Body == IntPtr.Zero || Shell == IntPtr.Zero) if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
{ {
if (value.IsFinite()) if (value.IsFinite())
@ -471,6 +473,7 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
set set
{ {
base.ChangingActorID = RegionSyncServerModule.ActorID;
if (value.IsFinite()) if (value.IsFinite())
{ {
m_pidControllerActive = true; m_pidControllerActive = true;
@ -792,6 +795,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
m_pidControllerActive = true; m_pidControllerActive = true;
_target_velocity = value; _target_velocity = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
} }
else else
{ {
@ -848,6 +852,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (force.IsFinite()) if (force.IsFinite())
{ {
base.ChangingActorID = RegionSyncServerModule.ActorID;
if (pushforce) if (pushforce)
{ {
m_pidControllerActive = false; m_pidControllerActive = false;

View File

@ -258,7 +258,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (PhysEngineToSceneConnectorModule.IsPhysEngineActorS) if (PhysEngineToSceneConnectorModule.IsPhysEngineActorS)
{ {
if (this.lastValues.Changed(this)) // if the values have changed and it was I who changed them, send an update
if (this.lastValues.Changed(this) && ChangingActorID == RegionSyncServerModule.ActorID)
PhysEngineToSceneConnectorModule.RouteUpdate(this); PhysEngineToSceneConnectorModule.RouteUpdate(this);
} }
else else
@ -2308,6 +2309,7 @@ Console.WriteLine(" JointCreateFixed");
get { return _position; } get { return _position; }
set { _position = value; set { _position = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
//m_log.Info("[PHYSICS]: " + _position.ToString()); //m_log.Info("[PHYSICS]: " + _position.ToString());
} }
} }
@ -2320,6 +2322,7 @@ Console.WriteLine(" JointCreateFixed");
if (value.IsFinite()) if (value.IsFinite())
{ {
_size = value; _size = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
} }
else else
{ {
@ -2342,6 +2345,7 @@ Console.WriteLine(" JointCreateFixed");
if (value.IsFinite()) if (value.IsFinite())
{ {
m_force = value; m_force = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
} }
else else
{ {
@ -2400,6 +2404,7 @@ Console.WriteLine(" JointCreateFixed");
{ {
_pbs = value; _pbs = value;
m_taintshape = true; m_taintshape = true;
base.ChangingActorID = RegionSyncServerModule.ActorID;
} }
} }
@ -2422,6 +2427,7 @@ Console.WriteLine(" JointCreateFixed");
{ {
if (value.IsFinite()) if (value.IsFinite())
{ {
base.ChangingActorID = RegionSyncServerModule.ActorID;
_velocity = value; _velocity = value;
m_taintVelocity = value; m_taintVelocity = value;
@ -2451,6 +2457,7 @@ Console.WriteLine(" JointCreateFixed");
{ {
m_taintTorque = value; m_taintTorque = value;
_parent_scene.AddPhysicsActorTaint(this); _parent_scene.AddPhysicsActorTaint(this);
base.ChangingActorID = RegionSyncServerModule.ActorID;
} }
else else
{ {
@ -2479,6 +2486,7 @@ Console.WriteLine(" JointCreateFixed");
if (QuaternionIsFinite(value)) if (QuaternionIsFinite(value))
{ {
_orientation = value; _orientation = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
} }
else else
m_log.Warn("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object"); m_log.Warn("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object");

View File

@ -91,18 +91,21 @@ public sealed class PEPrim : PhysicsActor
get { return _size; } get { return _size; }
set { _size = value; set { _size = value;
// m_log.Debug("[RPE] PEPrim set Size"); // m_log.Debug("[RPE] PEPrim set Size");
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Size, _size); Prop.Set(_localID, PropType.Size, _size);
} }
} }
public override PrimitiveBaseShape Shape { public override PrimitiveBaseShape Shape {
set { _pbs = value; set { _pbs = value;
m_log.Debug("[RPE] PEPrim set Shape"); m_log.Debug("[RPE] PEPrim set Shape");
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Shape, _pbs); Prop.Set(_localID, PropType.Shape, _pbs);
} }
} }
public override uint LocalID { public override uint LocalID {
set { _localID = value; set { _localID = value;
// m_log.Debug("[RPE] PEPrim set LocalID"); // m_log.Debug("[RPE] PEPrim set LocalID");
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.LocalID, _localID); Prop.Set(_localID, PropType.LocalID, _localID);
} }
get { return _localID; } get { return _localID; }
@ -127,6 +130,7 @@ public sealed class PEPrim : PhysicsActor
public override Vector3 Position { public override Vector3 Position {
get { return _position; } get { return _position; }
set { _position = value; set { _position = value;
ChangingActorID = RegionSyncServerModule.ActorID;
// m_log.Debug("[RPE] PEPrim set Position"); // m_log.Debug("[RPE] PEPrim set Position");
Prop.Set(_localID, PropType.Position, _position); Prop.Set(_localID, PropType.Position, _position);
} }
@ -137,6 +141,7 @@ public sealed class PEPrim : PhysicsActor
public override Vector3 Force { public override Vector3 Force {
get { return _force; } get { return _force; }
set { _force = value; set { _force = value;
ChangingActorID = RegionSyncServerModule.ActorID;
// m_log.Debug("[RPE] PEPrim set Force"); // m_log.Debug("[RPE] PEPrim set Force");
Prop.Set(_localID, PropType.Force, _force); Prop.Set(_localID, PropType.Force, _force);
} }
@ -159,18 +164,21 @@ public sealed class PEPrim : PhysicsActor
public override Vector3 Velocity { public override Vector3 Velocity {
get { return _velocity; } get { return _velocity; }
set { _velocity = value; set { _velocity = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Velocity, _velocity); Prop.Set(_localID, PropType.Velocity, _velocity);
} }
} }
public override Vector3 Torque { public override Vector3 Torque {
get { return _torque; } get { return _torque; }
set { _torque = value; set { _torque = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Torque, _torque); Prop.Set(_localID, PropType.Torque, _torque);
} }
} }
public override float CollisionScore { public override float CollisionScore {
get { return _collisionScore; } get { return _collisionScore; }
set { _collisionScore = value; set { _collisionScore = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.CollisionScore, _collisionScore); Prop.Set(_localID, PropType.CollisionScore, _collisionScore);
} }
} }
@ -180,22 +188,26 @@ public sealed class PEPrim : PhysicsActor
public override Quaternion Orientation { public override Quaternion Orientation {
get { return _orientation; } get { return _orientation; }
set { _orientation = value; set { _orientation = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Orientation, _orientation); Prop.Set(_localID, PropType.Orientation, _orientation);
} }
} }
public override int PhysicsActorType { public override int PhysicsActorType {
get { return _physicsActorType; } get { return _physicsActorType; }
set { _physicsActorType = value; set { _physicsActorType = value;
ChangingActorID = RegionSyncServerModule.ActorID;
} }
} }
public override bool IsPhysical { public override bool IsPhysical {
get { return _isPhysical; } get { return _isPhysical; }
set { _isPhysical = value; set { _isPhysical = value;
ChangingActorID = RegionSyncServerModule.ActorID;
} }
} }
public override bool Flying { public override bool Flying {
get { return _flying; } get { return _flying; }
set { _flying = value; set { _flying = value;
ChangingActorID = RegionSyncServerModule.ActorID;
} }
} }
public override bool public override bool

View File

@ -108,7 +108,8 @@ public class PEScene : PhysicsScene
// m_log.DebugFormat("[RPE]: Simulate. p={0}, a={1}", m_prims.Count, m_avatars.Count); // m_log.DebugFormat("[RPE]: Simulate. p={0}, a={1}", m_prims.Count, m_avatars.Count);
foreach (PEPrim prim in m_prims) foreach (PEPrim prim in m_prims)
{ {
if (prim.lastValues.Changed(prim)) // if the values have changed and it was I who changed them, send an update
if (prim.lastValues.Changed(prim) && prim.ChangingActorID == RegionSyncServerModule.ActorID)
{ {
SceneToPhysEngineSyncServer.RouteUpdate(prim); SceneToPhysEngineSyncServer.RouteUpdate(prim);
} }
@ -116,7 +117,8 @@ public class PEScene : PhysicsScene
foreach (PECharacter actor in m_avatars) foreach (PECharacter actor in m_avatars)
{ {
// m_log.DebugFormat("[RPE]: Simulate. p={0}, a={1}", m_prims.Count, m_avatars.Count); // m_log.DebugFormat("[RPE]: Simulate. p={0}, a={1}", m_prims.Count, m_avatars.Count);
if (actor.lastValues.Changed(actor)) // if the values have changed and it was I who changed them, send an update
if (actor.lastValues.Changed(actor) && actor.ChangingActorID == RegionSyncServerModule.ActorID)
{ {
SceneToPhysEngineSyncServer.RouteUpdate(actor); SceneToPhysEngineSyncServer.RouteUpdate(actor);
} }