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
{
uint localID = data["localID"].AsUInteger();
string actorID = data["actorID"].AsString();
// m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, localID);
PhysicsActor pa = FindPhysicsActor(localID);
if (pa != null)
{
Vector3 sizeTemp = data["size"].AsVector3();
if (sizeTemp.Z != 0)
{
// pa.Size = sizeTemp;
}
// pa.Size = data["size"].AsVector3();
pa.ChangingActorID = actorID;
pa.Position = data["position"].AsVector3();
pa.Force = data["force"].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);
OSDMap data = new OSDMap(9);
data["localID"] = OSD.FromUInteger(pa.LocalID);
data["actorID"] = OSD.FromString(RegionSyncServerModule.ActorID);
data["size"] = OSD.FromVector3(pa.Size);
data["position"] = OSD.FromVector3(pa.Position);
data["force"] = OSD.FromVector3(pa.Force);
@ -448,6 +447,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical);
data["flying"] = OSD.FromBoolean(pa.Flying);
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,
OSDParser.SerializeJsonString(data));

View File

@ -48,6 +48,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public class RegionSyncServerModule : IRegionModule, IRegionSyncServerModule, ICommandableModule
{
private static int DefaultPort = 13000;
public static string ActorID = "XX";
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@ -74,6 +75,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
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
string mode = syncConfig.GetString("Mode", "server").ToLower();
if(mode != "server")

View File

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

View File

@ -190,6 +190,8 @@ namespace OpenSim.Region.Physics.Manager
get { return m_baseLocalID; }
}
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; }

View File

@ -208,7 +208,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (PhysEngineToSceneConnectorModule.IsPhysEngineActorS)
{
// 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);
}
@ -426,6 +427,7 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return _position; }
set
{
base.ChangingActorID = RegionSyncServerModule.ActorID;
if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
{
if (value.IsFinite())
@ -471,6 +473,7 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
set
{
base.ChangingActorID = RegionSyncServerModule.ActorID;
if (value.IsFinite())
{
m_pidControllerActive = true;
@ -792,6 +795,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
m_pidControllerActive = true;
_target_velocity = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
}
else
{
@ -848,6 +852,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (force.IsFinite())
{
base.ChangingActorID = RegionSyncServerModule.ActorID;
if (pushforce)
{
m_pidControllerActive = false;

View File

@ -258,7 +258,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
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);
}
else
@ -2308,6 +2309,7 @@ Console.WriteLine(" JointCreateFixed");
get { return _position; }
set { _position = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
//m_log.Info("[PHYSICS]: " + _position.ToString());
}
}
@ -2320,6 +2322,7 @@ Console.WriteLine(" JointCreateFixed");
if (value.IsFinite())
{
_size = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
}
else
{
@ -2342,6 +2345,7 @@ Console.WriteLine(" JointCreateFixed");
if (value.IsFinite())
{
m_force = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
}
else
{
@ -2400,6 +2404,7 @@ Console.WriteLine(" JointCreateFixed");
{
_pbs = value;
m_taintshape = true;
base.ChangingActorID = RegionSyncServerModule.ActorID;
}
}
@ -2422,6 +2427,7 @@ Console.WriteLine(" JointCreateFixed");
{
if (value.IsFinite())
{
base.ChangingActorID = RegionSyncServerModule.ActorID;
_velocity = value;
m_taintVelocity = value;
@ -2451,6 +2457,7 @@ Console.WriteLine(" JointCreateFixed");
{
m_taintTorque = value;
_parent_scene.AddPhysicsActorTaint(this);
base.ChangingActorID = RegionSyncServerModule.ActorID;
}
else
{
@ -2479,6 +2486,7 @@ Console.WriteLine(" JointCreateFixed");
if (QuaternionIsFinite(value))
{
_orientation = value;
base.ChangingActorID = RegionSyncServerModule.ActorID;
}
else
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; }
set { _size = value;
// m_log.Debug("[RPE] PEPrim set Size");
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Size, _size);
}
}
public override PrimitiveBaseShape Shape {
set { _pbs = value;
m_log.Debug("[RPE] PEPrim set Shape");
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Shape, _pbs);
}
}
public override uint LocalID {
set { _localID = value;
// m_log.Debug("[RPE] PEPrim set LocalID");
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.LocalID, _localID);
}
get { return _localID; }
@ -127,6 +130,7 @@ public sealed class PEPrim : PhysicsActor
public override Vector3 Position {
get { return _position; }
set { _position = value;
ChangingActorID = RegionSyncServerModule.ActorID;
// m_log.Debug("[RPE] PEPrim set Position");
Prop.Set(_localID, PropType.Position, _position);
}
@ -137,6 +141,7 @@ public sealed class PEPrim : PhysicsActor
public override Vector3 Force {
get { return _force; }
set { _force = value;
ChangingActorID = RegionSyncServerModule.ActorID;
// m_log.Debug("[RPE] PEPrim set Force");
Prop.Set(_localID, PropType.Force, _force);
}
@ -159,18 +164,21 @@ public sealed class PEPrim : PhysicsActor
public override Vector3 Velocity {
get { return _velocity; }
set { _velocity = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Velocity, _velocity);
}
}
public override Vector3 Torque {
get { return _torque; }
set { _torque = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Torque, _torque);
}
}
public override float CollisionScore {
get { return _collisionScore; }
set { _collisionScore = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.CollisionScore, _collisionScore);
}
}
@ -180,22 +188,26 @@ public sealed class PEPrim : PhysicsActor
public override Quaternion Orientation {
get { return _orientation; }
set { _orientation = value;
ChangingActorID = RegionSyncServerModule.ActorID;
Prop.Set(_localID, PropType.Orientation, _orientation);
}
}
public override int PhysicsActorType {
get { return _physicsActorType; }
set { _physicsActorType = value;
ChangingActorID = RegionSyncServerModule.ActorID;
}
}
public override bool IsPhysical {
get { return _isPhysical; }
set { _isPhysical = value;
ChangingActorID = RegionSyncServerModule.ActorID;
}
}
public override bool Flying {
get { return _flying; }
set { _flying = value;
ChangingActorID = RegionSyncServerModule.ActorID;
}
}
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);
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);
}
@ -116,7 +117,8 @@ public class PEScene : PhysicsScene
foreach (PECharacter actor in m_avatars)
{
// 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);
}