PhysActor update messages working. Avatar and prim neither move nor position correctly
parent
5c6f0878a1
commit
a036426f18
|
@ -12,6 +12,7 @@ using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Framework.Client;
|
using OpenSim.Framework.Client;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -74,6 +75,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
private ActorType m_actorType = ActorType.PhysicsEngine;
|
private ActorType m_actorType = ActorType.PhysicsEngine;
|
||||||
|
|
||||||
private bool m_debugWithViewer = false;
|
private bool m_debugWithViewer = false;
|
||||||
|
private long m_messagesSent = 0;
|
||||||
|
private long m_messagesReceived = 0;
|
||||||
|
|
||||||
private QuarkSubsriptionInfo m_subscribedQuarks;
|
private QuarkSubsriptionInfo m_subscribedQuarks;
|
||||||
|
|
||||||
|
@ -165,7 +168,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
RegionSyncMessage msg = new RegionSyncMessage(RegionSyncMessage.MsgType.ActorStatus, Convert.ToString((int)ActorStatus.Sync));
|
RegionSyncMessage msg = new RegionSyncMessage(RegionSyncMessage.MsgType.ActorStatus, Convert.ToString((int)ActorStatus.Sync));
|
||||||
Send(msg);
|
Send(msg);
|
||||||
SendQuarkSubscription();
|
// SendQuarkSubscription();
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
DoInitialSync();
|
DoInitialSync();
|
||||||
}
|
}
|
||||||
|
@ -196,7 +199,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
private void DoInitialSync()
|
private void DoInitialSync()
|
||||||
{
|
{
|
||||||
m_validLocalScene.DeleteAllSceneObjects();
|
// m_validLocalScene.DeleteAllSceneObjects();
|
||||||
//m_log.Debug(LogHeader + ": send actor type " + m_actorType);
|
//m_log.Debug(LogHeader + ": send actor type " + m_actorType);
|
||||||
//Send(new RegionSyncMessage(RegionSyncMessage.MsgType.ActorType, Convert.ToString((int)m_actorType)));
|
//Send(new RegionSyncMessage(RegionSyncMessage.MsgType.ActorType, Convert.ToString((int)m_actorType)));
|
||||||
//KittyL??? Do we need to send in RegionName?
|
//KittyL??? Do we need to send in RegionName?
|
||||||
|
@ -204,8 +207,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//Send(new RegionSyncMessage(RegionSyncMessage.MsgType.RegionName, m_scene.RegionInfo.RegionName));
|
//Send(new RegionSyncMessage(RegionSyncMessage.MsgType.RegionName, m_scene.RegionInfo.RegionName));
|
||||||
//m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);
|
//m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetTerrain));
|
// Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetTerrain));
|
||||||
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetObjects));
|
// Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetObjects));
|
||||||
|
|
||||||
// Register for events which will be forwarded to authoritative scene
|
// Register for events which will be forwarded to authoritative scene
|
||||||
// m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
// m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||||
|
@ -229,6 +232,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
public void ReportStatus()
|
public void ReportStatus()
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("{0} Synchronized to RegionSyncServer at {1}:{2}", LogHeader, m_addr, m_port);
|
m_log.WarnFormat("{0} Synchronized to RegionSyncServer at {1}:{2}", LogHeader, m_addr, m_port);
|
||||||
|
m_log.WarnFormat("{0} Received={1}, Sent={2}", LogHeader, m_messagesReceived, m_messagesSent);
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
//TODO: should be reporting about the information of the objects/scripts
|
//TODO: should be reporting about the information of the objects/scripts
|
||||||
|
@ -278,6 +282,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//lock (m_syncRoot) -- KittyL: why do we need to lock here? We could lock inside HandleMessage if necessary, and lock on different objects for better performance
|
//lock (m_syncRoot) -- KittyL: why do we need to lock here? We could lock inside HandleMessage if necessary, and lock on different objects for better performance
|
||||||
|
m_messagesReceived++;
|
||||||
HandleMessage(msg);
|
HandleMessage(msg);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -310,6 +315,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_client.GetStream().Write(data, 0, data.Length);
|
m_client.GetStream().Write(data, 0, data.Length);
|
||||||
|
m_messagesSent++;
|
||||||
}
|
}
|
||||||
// If there is a problem reading from the client, shut 'er down.
|
// If there is a problem reading from the client, shut 'er down.
|
||||||
// *** Still need to alert the module that it's no longer connected!
|
// *** Still need to alert the module that it's no longer connected!
|
||||||
|
@ -319,79 +325,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Send requests to update object properties in the remote authoratative Scene.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="primID">UUID of the object</param>
|
|
||||||
/// <param name="pName">name of the property to be updated</param>
|
|
||||||
/// <param name="valParams">parameters of the value of the property</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void SendSetPrimProperties(UUID primID, string pName, object val)
|
|
||||||
{
|
|
||||||
OSDMap data = new OSDMap();
|
|
||||||
data["UUID"] = OSD.FromUUID(primID);
|
|
||||||
data["name"] = OSD.FromString(pName);
|
|
||||||
object[] valParams = (object[])val;
|
|
||||||
//data["param"] = OSD.FromString(presence.ControllingClient.LastName);
|
|
||||||
Vector3 pos, vel;
|
|
||||||
switch (pName)
|
|
||||||
{
|
|
||||||
case "object_rez":
|
|
||||||
//this is to rez an object from the prim's inventory, rather than change the prim's property
|
|
||||||
if(valParams.Length<5){
|
|
||||||
m_log.Warn(LogHeader+": values for object's "+pName+" property should include: inventory, pos, velocity, rotation, param");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string inventory = (string)valParams[0];
|
|
||||||
pos = (Vector3)valParams[1];
|
|
||||||
vel = (Vector3)valParams[2];
|
|
||||||
Quaternion rot = (Quaternion)valParams[3];
|
|
||||||
int param = (int)valParams[4];
|
|
||||||
data["inventory"]=OSD.FromString(inventory);
|
|
||||||
data["pos"]=OSD.FromVector3(pos);
|
|
||||||
data["vel"] = OSD.FromVector3(vel);
|
|
||||||
data["rot"] = OSD.FromQuaternion(rot);
|
|
||||||
data["param"] = OSD.FromInteger(param);
|
|
||||||
break;
|
|
||||||
case "color":
|
|
||||||
if(valParams.Length<2){
|
|
||||||
m_log.Warn(LogHeader+": values for object's "+pName+" property should include: color-x, color-y, color-z, face");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//double cx = (double)valParams[0];
|
|
||||||
//double cy = (double)valParams[1];
|
|
||||||
//double cz = (double)valParams[2];
|
|
||||||
//Vector3 color = new Vector3((float)cx, (float)cy, (float)cz);
|
|
||||||
Vector3 color = (Vector3)valParams[0];
|
|
||||||
data["color"] = OSD.FromVector3(color);
|
|
||||||
data["face"] = OSD.FromInteger((int)valParams[1]);
|
|
||||||
|
|
||||||
//m_log.DebugFormat("{0}: to set color {1} on face {2} of prim {3}", LogHeader, color.ToString(), (int)valParams[1], primID);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "pos":
|
|
||||||
if (valParams.Length < 1)
|
|
||||||
{
|
|
||||||
m_log.Warn(LogHeader + ": values for object's " + pName + " property should include: pos(vector)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//double px = (double)valParams[0];
|
|
||||||
//double py = (double)valParams[1];
|
|
||||||
//double pz = (double)valParams[2];
|
|
||||||
//Vector3 pos = new Vector3((float)px, (float)py, (float)pz);
|
|
||||||
pos = (Vector3)valParams[0];
|
|
||||||
data["pos"] = OSD.FromVector3(pos);
|
|
||||||
|
|
||||||
m_log.DebugFormat("{0}: to set pos {1} for prim {2}", LogHeader, pos.ToString(), primID);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.SetObjectProperty, OSDParser.SerializeJsonString(data)));
|
|
||||||
}
|
|
||||||
#endregion SEND
|
#endregion SEND
|
||||||
|
|
||||||
//KittyL: Has to define SendCoarseLocations() here, since it's defined in IRegionSyncClientModule.
|
//KittyL: Has to define SendCoarseLocations() here, since it's defined in IRegionSyncClientModule.
|
||||||
|
@ -415,16 +348,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RegionSyncMessage.MsgType.Terrain:
|
case RegionSyncMessage.MsgType.PhysUpdateAttributes:
|
||||||
{
|
{
|
||||||
//We need to handle terrain differently as we handle objects: we really will set the HeightMap
|
HandlePhysUpdateAttributes(msg);
|
||||||
//of each local scene that is the shadow copy of its auth. scene.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case RegionSyncMessage.MsgType.NewObject:
|
|
||||||
case RegionSyncMessage.MsgType.UpdatedObject:
|
|
||||||
{
|
|
||||||
HandleAddOrUpdateObjectInLocalScene(msg);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -436,6 +362,69 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The physics engine has some updates to the attributes. Unpack the parameters, find the
|
||||||
|
/// correct PhysicsActor and plug in the new values;
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
private void HandlePhysUpdateAttributes(RegionSyncMessage msg)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
uint localID = data["localID"].AsUInteger();
|
||||||
|
// m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, localID);
|
||||||
|
SceneObjectPart sop = m_validLocalScene.GetSceneObjectPart(localID);
|
||||||
|
if (sop != null)
|
||||||
|
{
|
||||||
|
sop.PhysActor.Size = data["size"].AsVector3();
|
||||||
|
sop.PhysActor.Position = data["position"].AsVector3();
|
||||||
|
sop.PhysActor.Force = data["force"].AsVector3();
|
||||||
|
sop.PhysActor.Velocity = data["velocity"].AsVector3();
|
||||||
|
sop.PhysActor.Torque = data["torque"].AsVector3();
|
||||||
|
sop.PhysActor.Orientation = data["orientantion"].AsQuaternion();
|
||||||
|
sop.PhysActor.IsPhysical = data["isPhysical"].AsBoolean(); // receive??
|
||||||
|
sop.PhysActor.Flying = data["flying"].AsBoolean(); // receive??
|
||||||
|
sop.PhysActor.Kinematic = data["kinematic"].AsBoolean(); // receive??
|
||||||
|
sop.PhysActor.Buoyancy = (float)(data["buoyancy"].AsReal());
|
||||||
|
sop.PhysActor.Shape = sop.Shape;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0}: attribute update for unknown localID {1}", LogHeader, localID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0}: EXCEPTION processing UpdateAttributes: {1}", LogHeader, e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendPhysUpdateAttributes(PhysicsActor pa)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("{0}: SendPhysUpdateAttributes for {1}", LogHeader, pa.LocalID);
|
||||||
|
OSDMap data = new OSDMap(9);
|
||||||
|
data["localID"] = OSD.FromUInteger(pa.LocalID);
|
||||||
|
data["size"] = OSD.FromVector3(pa.Size);
|
||||||
|
data["position"] = OSD.FromVector3(pa.Position);
|
||||||
|
data["force"] = OSD.FromVector3(pa.Force);
|
||||||
|
data["velocity"] = OSD.FromVector3(pa.Velocity);
|
||||||
|
data["torque"] = OSD.FromVector3(pa.Torque);
|
||||||
|
data["orientation"] = OSD.FromQuaternion(pa.Orientation);
|
||||||
|
data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical);
|
||||||
|
data["flying"] = OSD.FromBoolean(pa.Flying);
|
||||||
|
data["buoyancy"] = OSD.FromReal(pa.Buoyancy);
|
||||||
|
|
||||||
|
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.PhysUpdateAttributes,
|
||||||
|
OSDParser.SerializeJsonString(data));
|
||||||
|
Send(rsm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#region Utility functions
|
#region Utility functions
|
||||||
|
|
||||||
private OSDMap GetOSDMap(string strdata)
|
private OSDMap GetOSDMap(string strdata)
|
||||||
|
|
|
@ -35,6 +35,7 @@ using OpenSim.Framework.Client;
|
||||||
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
@ -51,6 +52,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
private string m_serveraddr;
|
private string m_serveraddr;
|
||||||
private int m_serverport;
|
private int m_serverport;
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
private static List<Scene> m_allScenes = new List<Scene>();
|
||||||
private ILog m_log;
|
private ILog m_log;
|
||||||
private Object m_client_lock = new Object();
|
private Object m_client_lock = new Object();
|
||||||
//private PhysEngineToSceneConnector m_scriptEngineToSceneConnector = null;
|
//private PhysEngineToSceneConnector m_scriptEngineToSceneConnector = null;
|
||||||
|
@ -64,6 +66,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
private Dictionary<string, PhysEngineToSceneConnector> m_PEToSceneConnectors = new Dictionary<string, PhysEngineToSceneConnector>(); //connector for each auth. scene
|
private Dictionary<string, PhysEngineToSceneConnector> m_PEToSceneConnectors = new Dictionary<string, PhysEngineToSceneConnector>(); //connector for each auth. scene
|
||||||
private string LogHeader = "[PhysEngineToSceneConnectorModule]";
|
private string LogHeader = "[PhysEngineToSceneConnectorModule]";
|
||||||
private PhysEngineToSceneConnector m_idlePEToSceneConnector = null;
|
private PhysEngineToSceneConnector m_idlePEToSceneConnector = null;
|
||||||
|
private PhysEngineToSceneConnector m_physEngineToSceneConnector = null;
|
||||||
|
|
||||||
//quark information
|
//quark information
|
||||||
//private int QuarkInfo.SizeX;
|
//private int QuarkInfo.SizeX;
|
||||||
|
@ -131,6 +134,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
InstallInterfaces();
|
InstallInterfaces();
|
||||||
|
|
||||||
m_log.Warn(LogHeader + " Initialised");
|
m_log.Warn(LogHeader + " Initialised");
|
||||||
|
|
||||||
|
// collect all the scenes for later routing
|
||||||
|
if (!m_allScenes.Contains(scene))
|
||||||
|
{
|
||||||
|
m_allScenes.Add(scene);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -202,6 +211,49 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
get { return (m_activeActors != 0); }
|
get { return (m_activeActors != 0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The scene is unknown by ODE so we have to look through the scenes to
|
||||||
|
/// find the one with this PhysicsActor so we can send the update.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pa"></param>
|
||||||
|
public static void RouteUpdate(PhysicsActor pa)
|
||||||
|
{
|
||||||
|
SceneObjectPart sop = null;
|
||||||
|
Scene s = null;
|
||||||
|
foreach (Scene ss in m_allScenes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sop = ss.GetSceneObjectPart(pa.LocalID);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
sop = null;
|
||||||
|
}
|
||||||
|
if (sop != null)
|
||||||
|
{
|
||||||
|
s = ss;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (s != null)
|
||||||
|
{
|
||||||
|
if (s.PhysEngineToSceneConnectorModule != null)
|
||||||
|
{
|
||||||
|
s.PhysEngineToSceneConnectorModule.SendUpdate(pa);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("RouteUpdate: PhysEngineToSceneConnectorModule is null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("RouteUpdate: no SOP found");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,6 +270,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendUpdate(PhysicsActor pa)
|
||||||
|
{
|
||||||
|
this.m_physEngineToSceneConnector.SendPhysUpdateAttributes(pa);
|
||||||
|
}
|
||||||
|
|
||||||
#region Console Command Interface
|
#region Console Command Interface
|
||||||
//IMPORTANT: these functions should only be actived for the PhysEngineToSceneConnectorModule that is associated with the valid local scene
|
//IMPORTANT: these functions should only be actived for the PhysEngineToSceneConnectorModule that is associated with the valid local scene
|
||||||
|
|
||||||
|
@ -307,11 +364,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
private void InitPhysEngineToSceneConnector(string space)
|
private void InitPhysEngineToSceneConnector(string space)
|
||||||
{
|
{
|
||||||
|
|
||||||
PhysEngineToSceneConnector scriptEngineToSceneConnector = new PhysEngineToSceneConnector(m_scene,
|
m_physEngineToSceneConnector = new PhysEngineToSceneConnector(m_scene,
|
||||||
m_serveraddr, m_serverport, m_debugWithViewer, /* space,*/ m_syncConfig);
|
m_serveraddr, m_serverport, m_debugWithViewer, /* space,*/ m_syncConfig);
|
||||||
if (scriptEngineToSceneConnector.Start())
|
if (m_physEngineToSceneConnector.Start())
|
||||||
{
|
{
|
||||||
m_PEToSceneConnectors.Add(m_scene.RegionInfo.RegionName, scriptEngineToSceneConnector);
|
m_PEToSceneConnectors.Add(m_scene.RegionInfo.RegionName, m_physEngineToSceneConnector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
ScriptStateSyncEnd,
|
ScriptStateSyncEnd,
|
||||||
//Idle script engine overloaded -> overloaded script engine
|
//Idle script engine overloaded -> overloaded script engine
|
||||||
ScriptStateSyncRequest,
|
ScriptStateSyncRequest,
|
||||||
|
// Physics Engine -> Scene
|
||||||
|
PhysTerseUpdate,
|
||||||
|
PhysOutOfBounds,
|
||||||
|
PhysCollisionUpdate,
|
||||||
|
// Scene -> Physics Engine
|
||||||
|
PhysUpdateAttributes,
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
@ -94,7 +95,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
public string GetStats()
|
public string GetStats()
|
||||||
{
|
{
|
||||||
int syncedAvCount;
|
|
||||||
string ret;
|
string ret;
|
||||||
//lock (m_syncRoot)
|
//lock (m_syncRoot)
|
||||||
// syncedAvCount = m_syncedAvatars.Count;
|
// syncedAvCount = m_syncedAvatars.Count;
|
||||||
|
@ -103,7 +103,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
double secondsSinceLastStats = DateTime.Now.Subtract(lastStatTime).TotalSeconds;
|
double secondsSinceLastStats = DateTime.Now.Subtract(lastStatTime).TotalSeconds;
|
||||||
lastStatTime = DateTime.Now;
|
lastStatTime = DateTime.Now;
|
||||||
|
|
||||||
ret = String.Format("[{0,4}/{1,4}], [{2,4}/{3,4}], [{4,4}/{5,4}], [{6,4} ({7,4})], [{8,8} ({9,8:00.00})], [{10,4} ({11,4})], [{12,8} ({13,8:00.00})], [{14,8} ({15,4}]",
|
// ret = String.Format("[{0,4}/{1,4}], [{2,4}/{3,4}], [{4,4}/{5,4}], [{6,4} ({7,4})], [{8,8} ({9,8:00.00})], [{10,4} ({11,4})], [{12,8} ({13,8:00.00})], [{14,8} ({15,4}]",
|
||||||
|
ret = String.Format("[{0,4}/{1,4}], [{2,6}/{3,6}], [{4,4}/{5,4}], [{6,6} ({7,6})], [{8,4} ({9,4})]",
|
||||||
//lastTotalCount, totalAvCount, // TOTAL AVATARS
|
//lastTotalCount, totalAvCount, // TOTAL AVATARS
|
||||||
//lastLocalCount, syncedAvCount, // LOCAL TO THIS CLIENT VIEW
|
//lastLocalCount, syncedAvCount, // LOCAL TO THIS CLIENT VIEW
|
||||||
//lastRemoteCount, totalAvCount - syncedAvCount, // REMOTE (SHOULD = TOTAL - LOCAL)
|
//lastRemoteCount, totalAvCount - syncedAvCount, // REMOTE (SHOULD = TOTAL - LOCAL)
|
||||||
|
@ -162,7 +163,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_receive_loop.Start();
|
m_receive_loop.Start();
|
||||||
|
|
||||||
//tell the remote script engine about the locX, locY of this authoritative scene
|
//tell the remote script engine about the locX, locY of this authoritative scene
|
||||||
SendSceneLoc();
|
// SendSceneLoc();
|
||||||
|
m_log.DebugFormat("{0}: SceneToPhysEngineConnector initialized", LogHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the listening thread, disconnecting the RegionSyncPhysEngine
|
// Stop the listening thread, disconnecting the RegionSyncPhysEngine
|
||||||
|
@ -258,6 +260,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case RegionSyncMessage.MsgType.PhysTerseUpdate:
|
||||||
|
{
|
||||||
|
HandlePhysTerseUpdate(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case RegionSyncMessage.MsgType.PhysOutOfBounds:
|
||||||
|
{
|
||||||
|
HandlePhysOutOfBounds(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case RegionSyncMessage.MsgType.PhysCollisionUpdate:
|
||||||
|
{
|
||||||
|
HandlePhysCollisionUpdate(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case RegionSyncMessage.MsgType.PhysUpdateAttributes:
|
||||||
|
{
|
||||||
|
HandlePhysUpdateAttributes(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("{0} Unable to handle unsupported message type", LogHeader);
|
m_log.WarnFormat("{0} Unable to handle unsupported message type", LogHeader);
|
||||||
|
@ -266,6 +288,86 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandlePhysTerseUpdate(RegionSyncMessage msg)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandlePhysOutOfBounds(RegionSyncMessage msg)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandlePhysCollisionUpdate(RegionSyncMessage msg)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The physics engine has some updates to the attributes. Unpack the parameters, find the
|
||||||
|
/// correct PhysicsActor and plug in the new values;
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
private void HandlePhysUpdateAttributes(RegionSyncMessage msg)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
uint localID = data["localID"].AsUInteger();
|
||||||
|
m_log.DebugFormat("{0}: received PhysUpdateAttributes for {1}", LogHeader, localID);
|
||||||
|
SceneObjectPart sop = m_scene.GetSceneObjectPart(localID);
|
||||||
|
if (sop != null)
|
||||||
|
{
|
||||||
|
sop.PhysActor.Size = data["size"].AsVector3();
|
||||||
|
sop.PhysActor.Position = data["position"].AsVector3();
|
||||||
|
sop.PhysActor.Force = data["force"].AsVector3();
|
||||||
|
sop.PhysActor.Velocity = data["velocity"].AsVector3();
|
||||||
|
sop.PhysActor.Torque = data["torque"].AsVector3();
|
||||||
|
sop.PhysActor.Orientation = data["orientantion"].AsQuaternion();
|
||||||
|
sop.PhysActor.IsPhysical = data["isPhysical"].AsBoolean(); // receive??
|
||||||
|
sop.PhysActor.Flying = data["flying"].AsBoolean(); // receive??
|
||||||
|
sop.PhysActor.Kinematic = data["kinematic"].AsBoolean(); // receive??
|
||||||
|
sop.PhysActor.Buoyancy = (float)(data["buoyancy"].AsReal());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0}: attribute update for unknown localID {1}", LogHeader, localID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0}: EXCEPTION processing UpdateAttributes: {1}", LogHeader, e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendPhysUpdateAttributes(PhysicsActor pa)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("{0}: sending PhysUpdateAttributes for {1}", LogHeader, pa.LocalID);
|
||||||
|
OSDMap data = new OSDMap(9);
|
||||||
|
data["localID"] = OSD.FromUInteger(pa.LocalID);
|
||||||
|
data["size"] = OSD.FromVector3(pa.Size);
|
||||||
|
data["position"] = OSD.FromVector3(pa.Position);
|
||||||
|
data["force"] = OSD.FromVector3(pa.Force);
|
||||||
|
data["velocity"] = OSD.FromVector3(pa.Velocity);
|
||||||
|
data["torque"] = OSD.FromVector3(pa.Torque);
|
||||||
|
data["orientation"] = OSD.FromQuaternion(pa.Orientation);
|
||||||
|
data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical);
|
||||||
|
data["flying"] = OSD.FromBoolean(pa.Flying);
|
||||||
|
data["buoyancy"] = OSD.FromReal(pa.Buoyancy);
|
||||||
|
|
||||||
|
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.PhysUpdateAttributes,
|
||||||
|
OSDParser.SerializeJsonString(data));
|
||||||
|
Send(rsm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//For simplicity, we assume the subscription sent by PhysEngine is legistimate (no overlapping with other script engines, etc)
|
//For simplicity, we assume the subscription sent by PhysEngine is legistimate (no overlapping with other script engines, etc)
|
||||||
private void HandleQuarkSubscription(RegionSyncMessage msg)
|
private void HandleQuarkSubscription(RegionSyncMessage msg)
|
||||||
{
|
{
|
||||||
|
@ -335,7 +437,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_tcpclient.GetStream().EndWrite(ar);
|
m_tcpclient.GetStream().EndWrite(ar);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ }
|
{
|
||||||
|
m_log.WarnFormat("{0} Write to output stream failed", LogHeader);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
@ -344,6 +448,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_log.WarnFormat("{0} Physics Engine has disconnected.", LogHeader);
|
m_log.WarnFormat("{0} Physics Engine has disconnected.", LogHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("{0} Attempt to send with no connection", LogHeader);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendObjectUpdate(RegionSyncMessage.MsgType msgType, SceneObjectGroup sog)
|
public void SendObjectUpdate(RegionSyncMessage.MsgType msgType, SceneObjectGroup sog)
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -13,6 +14,7 @@ using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
|
@ -41,7 +43,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
|
|
||||||
//Here is the per actor type listening server for physics Engines.
|
//Here is the per actor type listening server for physics Engines.
|
||||||
public class SceneToPhysEngineSyncServer : ISceneToPhysEngineServer
|
public class SceneToPhysEngineSyncServer : ISceneToPhysEngineServer, ICommandableModule
|
||||||
{
|
{
|
||||||
#region SceneToPhysEngineSyncServer members
|
#region SceneToPhysEngineSyncServer members
|
||||||
// Set the addr and port for TcpListener
|
// Set the addr and port for TcpListener
|
||||||
|
@ -61,6 +63,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
// static counters that are used to compute global configuration state
|
// static counters that are used to compute global configuration state
|
||||||
private static int m_syncServerInitialized = 0;
|
private static int m_syncServerInitialized = 0;
|
||||||
private static int m_totalConnections = 0;
|
private static int m_totalConnections = 0;
|
||||||
|
private static List<Scene> m_allScenes = new List<Scene>();
|
||||||
|
|
||||||
// The local scene.
|
// The local scene.
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
@ -74,6 +77,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
private object m_physEngineConnector_lock = new object();
|
private object m_physEngineConnector_lock = new object();
|
||||||
//private Dictionary<string, SceneToPhysEngineConnector> m_physEngineConnectors = new Dictionary<string, SceneToPhysEngineConnector>();
|
//private Dictionary<string, SceneToPhysEngineConnector> m_physEngineConnectors = new Dictionary<string, SceneToPhysEngineConnector>();
|
||||||
private List<SceneToPhysEngineConnector> m_physEngineConnectors = new List<SceneToPhysEngineConnector>();
|
private List<SceneToPhysEngineConnector> m_physEngineConnectors = new List<SceneToPhysEngineConnector>();
|
||||||
|
// the last connector created
|
||||||
|
private SceneToPhysEngineConnector m_sceneToPhysEngineConnector = null;
|
||||||
|
|
||||||
//list of idle physics engines that have registered.
|
//list of idle physics engines that have registered.
|
||||||
private List<IdlePhysEngineInfo> m_idlePhysEngineList = new List<IdlePhysEngineInfo>();
|
private List<IdlePhysEngineInfo> m_idlePhysEngineList = new List<IdlePhysEngineInfo>();
|
||||||
|
@ -88,27 +93,176 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//private int QuarkInfo.SizeX;
|
//private int QuarkInfo.SizeX;
|
||||||
//private int QuarkInfo.SizeY;
|
//private int QuarkInfo.SizeY;
|
||||||
|
|
||||||
|
#region ICommandableModule Members
|
||||||
|
private readonly Commander m_commander = new Commander("phys");
|
||||||
|
public ICommander CommandInterface
|
||||||
|
{
|
||||||
|
get { return m_commander; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InstallInterfaces()
|
||||||
|
{
|
||||||
|
// Command cmdSyncStart = new Command("start", CommandIntentions.COMMAND_HAZARDOUS, SyncStart, "Begins synchronization with RegionSyncServer.");
|
||||||
|
//cmdSyncStart.AddArgument("server_port", "The port of the server to synchronize with", "Integer");
|
||||||
|
|
||||||
|
// Command cmdSyncStop = new Command("stop", CommandIntentions.COMMAND_HAZARDOUS, SyncStop, "Stops synchronization with RegionSyncServer.");
|
||||||
|
//cmdSyncStop.AddArgument("server_address", "The IP address of the server to synchronize with", "String");
|
||||||
|
//cmdSyncStop.AddArgument("server_port", "The port of the server to synchronize with", "Integer");
|
||||||
|
|
||||||
|
Command cmdSyncStatus = new Command("status", CommandIntentions.COMMAND_HAZARDOUS, SyncStatus, "Displays synchronization status.");
|
||||||
|
|
||||||
|
//The following two commands are more for easier debugging purpose
|
||||||
|
// Command cmdSyncSetQuarks = new Command("quarkSpace", CommandIntentions.COMMAND_HAZARDOUS, SetQuarkList, "Set the set of quarks to subscribe to. For debugging purpose. Should be issued before \"sync start\"");
|
||||||
|
// cmdSyncSetQuarks.AddArgument("quarkSpace", "The (rectangle) space of quarks to subscribe, represented by x0_y0,x1_y1, the left-bottom and top-right corners of the rectangel space", "String");
|
||||||
|
|
||||||
|
// Command cmdSyncSetQuarkSize = new Command("quarksize", CommandIntentions.COMMAND_HAZARDOUS, SetQuarkSize, "Set the size of each quark. For debugging purpose. Should be issued before \"sync quarks\"");
|
||||||
|
// cmdSyncSetQuarkSize.AddArgument("quarksizeX", "The size on x axis of each quark", "Integer");
|
||||||
|
// cmdSyncSetQuarkSize.AddArgument("quarksizeY", "The size on y axis of each quark", "Integer");
|
||||||
|
|
||||||
|
// m_commander.RegisterCommand("start", cmdSyncStart);
|
||||||
|
// m_commander.RegisterCommand("stop", cmdSyncStop);
|
||||||
|
m_commander.RegisterCommand("status", cmdSyncStatus);
|
||||||
|
// m_commander.RegisterCommand("quarkSpace", cmdSyncSetQuarks);
|
||||||
|
|
||||||
|
lock (m_scene)
|
||||||
|
{
|
||||||
|
// Add this to our scene so scripts can call these functions
|
||||||
|
m_scene.RegisterModuleCommander(m_commander);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Processes commandline input. Do not call directly.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">Commandline arguments</param>
|
||||||
|
private void EventManager_OnPluginConsole(string[] args)
|
||||||
|
{
|
||||||
|
if (args[0] == "phys")
|
||||||
|
{
|
||||||
|
if (args.Length == 1)
|
||||||
|
{
|
||||||
|
m_commander.ProcessConsoleCommand("help", new string[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] tmpArgs = new string[args.Length - 2];
|
||||||
|
int i;
|
||||||
|
for (i = 2; i < args.Length; i++)
|
||||||
|
tmpArgs[i - 2] = args[i];
|
||||||
|
|
||||||
|
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SyncStart(Object[] args)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
private void SyncStop(Object[] args)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
private void SyncStatus(Object[] args)
|
||||||
|
{
|
||||||
|
lock (m_physEngineConnector_lock)
|
||||||
|
{
|
||||||
|
if (m_physEngineConnectors.Count == 0)
|
||||||
|
{
|
||||||
|
m_log.Warn(LogHeader + " Not currently synchronized");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_log.Warn(LogHeader + " Synchronized");
|
||||||
|
foreach (SceneToPhysEngineConnector pec in m_physEngineConnectors)
|
||||||
|
{
|
||||||
|
m_log.Warn(pec.GetStats());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
// Check if any of the client views are in a connected state
|
// Check if any of the client views are in a connected state
|
||||||
public bool Synced
|
public bool Synced
|
||||||
{
|
{
|
||||||
get
|
get { return (m_physEngineConnectors.Count > 0); }
|
||||||
{
|
|
||||||
return (m_physEngineConnectors.Count > 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static bool IsPhysEngineScene
|
public static bool IsPhysEngineScene
|
||||||
{
|
{
|
||||||
get { return (m_syncServerInitialized != 0); }
|
get { return (SceneToPhysEngineSyncServer.m_syncServerInitialized > 0); }
|
||||||
|
}
|
||||||
|
public static bool IsPhysEngineScene2()
|
||||||
|
{
|
||||||
|
return (SceneToPhysEngineSyncServer.m_syncServerInitialized > 0);
|
||||||
}
|
}
|
||||||
public static bool IsActivePhysEngineScene
|
public static bool IsActivePhysEngineScene
|
||||||
{
|
{
|
||||||
get { return (m_syncServerInitialized != 0 && m_totalConnections != 0); }
|
get {
|
||||||
|
System.Console.WriteLine("IsActivePhysEngineScene: si={0} tc={1}",
|
||||||
|
SceneToPhysEngineSyncServer.m_syncServerInitialized,
|
||||||
|
SceneToPhysEngineSyncServer.m_totalConnections);
|
||||||
|
return (SceneToPhysEngineSyncServer.m_syncServerInitialized > 0
|
||||||
|
&& SceneToPhysEngineSyncServer.m_totalConnections > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static bool IsActivePhysEngineScene2()
|
||||||
|
{
|
||||||
|
return (SceneToPhysEngineSyncServer.m_syncServerInitialized > 0
|
||||||
|
&& SceneToPhysEngineSyncServer.m_totalConnections > 0);
|
||||||
}
|
}
|
||||||
public static bool IsPhysEngineActor
|
public static bool IsPhysEngineActor
|
||||||
{
|
{
|
||||||
get { return PhysEngineToSceneConnectorModule.IsPhysEngineActor; }
|
get { return PhysEngineToSceneConnectorModule.IsPhysEngineActor; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The scene is unknown by ODE so we have to look through the scenes to
|
||||||
|
/// find the one with this PhysicsActor so we can send the update.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pa"></param>
|
||||||
|
public static void RouteUpdate(PhysicsActor pa)
|
||||||
|
{
|
||||||
|
SceneObjectPart sop = null;
|
||||||
|
Scene s = null;
|
||||||
|
foreach (Scene ss in m_allScenes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sop = ss.GetSceneObjectPart(pa.LocalID);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
sop = null;
|
||||||
|
}
|
||||||
|
if (sop != null)
|
||||||
|
{
|
||||||
|
s = ss;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (s != null)
|
||||||
|
{
|
||||||
|
if (s.SceneToPhysEngineSyncServer != null)
|
||||||
|
{
|
||||||
|
s.SceneToPhysEngineSyncServer.SendUpdate(pa);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("RouteUpdate: SceneToPhysEngineSyncServer is no available");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("RouteUpdate: no SOP for update");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendUpdate(PhysicsActor pa)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("{0}: SendUpdate for {1}", LogHeader, pa.LocalID);
|
||||||
|
this.m_sceneToPhysEngineConnector.SendPhysUpdateAttributes(pa);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -126,8 +280,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_addr = IPAddress.Parse(addr);
|
m_addr = IPAddress.Parse(addr);
|
||||||
m_port = port;
|
m_port = port;
|
||||||
|
|
||||||
|
m_scene.RegisterModuleInterface<ISceneToPhysEngineServer>(this);
|
||||||
|
|
||||||
|
// remember all the scenes that are configured for connection to physics engine
|
||||||
|
if (!m_allScenes.Contains(m_scene))
|
||||||
|
{
|
||||||
|
m_allScenes.Add(m_scene);
|
||||||
|
}
|
||||||
|
|
||||||
InitQuarksInScene();
|
InitQuarksInScene();
|
||||||
SubscribeToEvents();
|
SubscribeToEvents();
|
||||||
|
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||||
|
InstallInterfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,12 +306,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
// Start the server
|
// Start the server
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
SceneToPhysEngineSyncServer.m_syncServerInitialized++;
|
||||||
m_listenerThread = new Thread(new ThreadStart(Listen));
|
m_listenerThread = new Thread(new ThreadStart(Listen));
|
||||||
m_listenerThread.Name = "SceneToPhysEngineSyncServer Listener";
|
m_listenerThread.Name = "SceneToPhysEngineSyncServer Listener";
|
||||||
m_log.WarnFormat(LogHeader + ": Starting {0} thread", m_listenerThread.Name);
|
m_log.DebugFormat("{0}: Starting {1} thread", LogHeader, m_listenerThread.Name);
|
||||||
m_listenerThread.Start();
|
m_listenerThread.Start();
|
||||||
//m_log.Warn("[REGION SYNC SERVER] Started");
|
// m_log.DebugFormat("{0}: Started", LogHeader);
|
||||||
m_syncServerInitialized++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,7 +319,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
// Stop the server and disconnect all RegionSyncClients
|
// Stop the server and disconnect all RegionSyncClients
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
m_syncServerInitialized--;
|
m_log.DebugFormat("{0}: Shutdown", LogHeader);
|
||||||
|
SceneToPhysEngineSyncServer.m_syncServerInitialized--;
|
||||||
// Stop the listener and listening thread so no new clients are accepted
|
// Stop the listener and listening thread so no new clients are accepted
|
||||||
m_listener.Stop();
|
m_listener.Stop();
|
||||||
m_listenerThread.Abort();
|
m_listenerThread.Abort();
|
||||||
|
@ -197,12 +362,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
lock (m_physEngineConnector_lock)
|
lock (m_physEngineConnector_lock)
|
||||||
{
|
{
|
||||||
//Dictionary<string, SceneToPhysEngineConnector> currentlist = m_physEngineConnectors;
|
|
||||||
//Dictionary<string, SceneToPhysEngineConnector> newlist = new Dictionary<string, SceneToPhysEngineConnector>(currentlist);
|
|
||||||
m_physEngineConnectors.Add(peConnector);
|
m_physEngineConnectors.Add(peConnector);
|
||||||
// Threads holding the previous version of the list can keep using it since
|
m_sceneToPhysEngineConnector = peConnector;
|
||||||
// they will not hold it for long and get a new copy next time they need to iterate
|
|
||||||
//m_physEngineConnectors = newlist;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,6 +398,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
TcpClient tcpclient = m_listener.AcceptTcpClient();
|
TcpClient tcpclient = m_listener.AcceptTcpClient();
|
||||||
IPAddress addr = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Address;
|
IPAddress addr = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Address;
|
||||||
int port = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Port;
|
int port = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Port;
|
||||||
|
SceneToPhysEngineSyncServer.m_totalConnections++;
|
||||||
|
// m_log.DebugFormat("{0}: m_totalConnections = {1}", LogHeader, SceneToPhysEngineSyncServer.m_totalConnections);
|
||||||
|
|
||||||
ActorStatus actorStatus = GetActorStatus(tcpclient);
|
ActorStatus actorStatus = GetActorStatus(tcpclient);
|
||||||
|
|
||||||
|
@ -249,10 +412,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
break;
|
break;
|
||||||
case ActorStatus.Idle:
|
case ActorStatus.Idle:
|
||||||
IdlePhysEngineInfo idleSE = new IdlePhysEngineInfo(tcpclient);
|
IdlePhysEngineInfo idleSE = new IdlePhysEngineInfo(tcpclient);
|
||||||
m_log.Debug(": adding an idle SE ("+addr+","+port+")");
|
m_log.DebugFormat("{0}: adding an idle SE ({1}:{2})", LogHeader, addr, port);
|
||||||
m_idlePhysEngineList.Add(idleSE);
|
m_idlePhysEngineList.Add(idleSE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
m_log.DebugFormat("{0}: Unknown actor status", LogHeader);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +424,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
catch (SocketException e)
|
catch (SocketException e)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(LogHeader + " [Listen] SocketException: {0}", e);
|
m_log.WarnFormat("{0}: [Listen] SocketException: {1}", LogHeader, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
|
@ -40,5 +41,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
// static bool IsActivePhysEngineScene { get; }
|
// static bool IsActivePhysEngineScene { get; }
|
||||||
// static bool IsPhysEngineActor { get; }
|
// static bool IsPhysEngineActor { get; }
|
||||||
bool DebugWithViewer { get; }
|
bool DebugWithViewer { get; }
|
||||||
|
void SendUpdate(PhysicsActor pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,6 +30,7 @@
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
|
@ -39,5 +40,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
// static bool IsPhysEngineScene { get; }
|
// static bool IsPhysEngineScene { get; }
|
||||||
// static bool IsActivePhysEngineScene { get; }
|
// static bool IsActivePhysEngineScene { get; }
|
||||||
// static bool IsPhysEngineActor { get; }
|
// static bool IsPhysEngineActor { get; }
|
||||||
|
void SendUpdate(PhysicsActor pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -415,28 +415,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected ISceneToPhysEngineServer m_sceneToPhysEngineSyncServer = null;
|
protected ISceneToPhysEngineServer m_sceneToPhysEngineSyncServer = null;
|
||||||
public ISceneToPhysEngineServer SceneToPhysEngineSyncServer
|
public ISceneToPhysEngineServer SceneToPhysEngineSyncServer
|
||||||
{
|
{
|
||||||
get { return m_sceneToPhysEngineSyncServer; }
|
get
|
||||||
|
{
|
||||||
|
if (m_sceneToPhysEngineSyncServer == null)
|
||||||
|
{
|
||||||
|
// kludge since this module is loaded in postInitialize
|
||||||
|
m_sceneToPhysEngineSyncServer = RequestModuleInterface<ISceneToPhysEngineServer>();
|
||||||
|
}
|
||||||
|
return m_sceneToPhysEngineSyncServer;
|
||||||
|
}
|
||||||
set { m_sceneToPhysEngineSyncServer = value; }
|
set { m_sceneToPhysEngineSyncServer = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// list of physactors for this scene so we can find them later for remote physics
|
|
||||||
public Dictionary<uint, PhysicsActor> PhysActors = new Dictionary<uint, PhysicsActor>();
|
|
||||||
public void AddPhysActor(uint id, PhysicsActor pActor)
|
|
||||||
{
|
|
||||||
if (PhysActors.ContainsKey(id)) {
|
|
||||||
PhysActors.Remove(id);
|
|
||||||
}
|
|
||||||
PhysActors.Add(id, pActor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
public void RemovePhysActor(uint id)
|
|
||||||
{
|
|
||||||
if (PhysActors.ContainsKey(id)) {
|
|
||||||
PhysActors.Remove(id);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//This function should only be called by an actor who's local Scene is just a cache of the authorative Scene.
|
//This function should only be called by an actor who's local Scene is just a cache of the authorative Scene.
|
||||||
|
|
|
@ -997,7 +997,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
{
|
{
|
||||||
Scene.RemovePhysActor(m_rootPart.PhysActor.LocalID);
|
|
||||||
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
|
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
|
||||||
m_rootPart.PhysActor = null;
|
m_rootPart.PhysActor = null;
|
||||||
}
|
}
|
||||||
|
@ -2275,7 +2274,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
//if (linkPart.PhysActor != null)
|
//if (linkPart.PhysActor != null)
|
||||||
//{
|
//{
|
||||||
// m_scene.RemovePhysActor(linkPart.PhysActor.LocalID);
|
|
||||||
// m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
|
// m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
|
||||||
|
|
||||||
//linkPart.PhysActor = null;
|
//linkPart.PhysActor = null;
|
||||||
|
@ -2390,7 +2388,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (linkPart.PhysActor != null)
|
if (linkPart.PhysActor != null)
|
||||||
{
|
{
|
||||||
m_scene.RemovePhysActor(linkPart.PhysActor.LocalID);
|
|
||||||
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
|
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1492,8 +1492,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
|
PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
|
||||||
PhysActor.SOPDescription = this.Description;
|
PhysActor.SOPDescription = this.Description;
|
||||||
PhysActor.LocalID = LocalId;
|
PhysActor.LocalID = LocalId;
|
||||||
// RA: register PhysActor with the scene
|
|
||||||
ParentGroup.Scene.AddPhysActor(LocalId, PhysActor);
|
|
||||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||||
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -1756,7 +1754,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
|
|
||||||
// If we're not what we're supposed to be in the physics scene, recreate ourselves.
|
// If we're not what we're supposed to be in the physics scene, recreate ourselves.
|
||||||
//ParentGroup.Scene.RemovePhysActor(PhysActor.LocalID);
|
|
||||||
//m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
//m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
||||||
/// that's not wholesome. Had to make Scene public
|
/// that's not wholesome. Had to make Scene public
|
||||||
//PhysActor = null;
|
//PhysActor = null;
|
||||||
|
@ -4286,7 +4283,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AddFlag(PrimFlags.Phantom);
|
AddFlag(PrimFlags.Phantom);
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
{
|
{
|
||||||
ParentGroup.Scene.RemovePhysActor(PhysActor.LocalID);
|
|
||||||
m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
||||||
/// that's not wholesome. Had to make Scene public
|
/// that's not wholesome. Had to make Scene public
|
||||||
PhysActor = null;
|
PhysActor = null;
|
||||||
|
@ -4312,8 +4308,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
{
|
{
|
||||||
pa.LocalID = LocalId;
|
pa.LocalID = LocalId;
|
||||||
// RA: register PhysActor with scene
|
|
||||||
ParentGroup.Scene.AddPhysActor(LocalId, PhysActor);
|
|
||||||
DoPhysicsPropertyUpdate(UsePhysics, true);
|
DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,6 +115,39 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Structure to hold previous values of the PhysicsActor. This is used to see
|
||||||
|
/// if the values changed before sending updates to the Physics Engine.
|
||||||
|
/// </summary>
|
||||||
|
public struct PhysActorLastValues
|
||||||
|
{
|
||||||
|
public uint localID;
|
||||||
|
public Vector3 size;
|
||||||
|
public Vector3 position;
|
||||||
|
public Vector3 force;
|
||||||
|
public Vector3 velocity;
|
||||||
|
public Vector3 torque;
|
||||||
|
public Quaternion orientation;
|
||||||
|
public Boolean isPhysical;
|
||||||
|
public Boolean flying;
|
||||||
|
public double buoyancy;
|
||||||
|
public bool Changed(PhysicsActor pa)
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
if (localID != pa.LocalID) { localID = pa.LocalID; ret = true; }
|
||||||
|
if (size != pa.Size) { size = pa.Size; ret = true; }
|
||||||
|
if (position != pa.Position) { position = pa.Position; ret = true; }
|
||||||
|
if (force != pa.Force) { force = pa.Force; ret = true; }
|
||||||
|
if (velocity != pa.Velocity) { velocity = pa.Velocity; ret = true; }
|
||||||
|
if (torque != pa.Torque) { torque = pa.Torque; ret = true; }
|
||||||
|
if (orientation != pa.Orientation) { orientation = pa.Orientation; ret = true; }
|
||||||
|
if (isPhysical != pa.IsPhysical) { isPhysical = pa.IsPhysical; ret = true; }
|
||||||
|
if (flying != pa.Flying) { flying = pa.Flying; ret = true; }
|
||||||
|
if (buoyancy != pa.Buoyancy) { buoyancy = pa.Buoyancy; ret = true; }
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract class PhysicsActor
|
public abstract class PhysicsActor
|
||||||
{
|
{
|
||||||
public delegate void RequestTerseUpdate();
|
public delegate void RequestTerseUpdate();
|
||||||
|
@ -144,6 +177,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
// RA: used to be abstract but changed to allow 'get' without changing all the phys engines
|
// RA: used to be abstract but changed to allow 'get' without changing all the phys engines
|
||||||
public virtual uint LocalID { set { return; } get { return 0; } }
|
public virtual uint LocalID { set { return; } get { return 0; } }
|
||||||
|
public PhysActorLastValues lastValues;
|
||||||
|
|
||||||
public abstract bool Grabbed { set; }
|
public abstract bool Grabbed { set; }
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ using OpenMetaverse;
|
||||||
using Ode.NET;
|
using Ode.NET;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
using OpenSim.Region.CoreModules.RegionSync.RegionSyncModule;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.OdePlugin
|
namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
@ -202,6 +203,19 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_name = avName;
|
m_name = avName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RequestPhysicsterseUpdate()
|
||||||
|
{
|
||||||
|
if (PhysEngineToSceneConnectorModule.IsPhysEngineActor)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ODE CHARACTER]: Sending terse update for {0}", LocalID);
|
||||||
|
PhysEngineToSceneConnectorModule.RouteUpdate(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.RequestPhysicsterseUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int PhysicsActorType
|
public override int PhysicsActorType
|
||||||
{
|
{
|
||||||
get { return (int) ActorTypes.Agent; }
|
get { return (int) ActorTypes.Agent; }
|
||||||
|
|
|
@ -47,7 +47,9 @@ using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using Ode.NET;
|
using Ode.NET;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
using OpenSim.Region.CoreModules.RegionSync.RegionSyncModule;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.OdePlugin
|
namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
|
@ -252,6 +254,18 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// don't do .add() here; old geoms get recycled with the same hash
|
// don't do .add() here; old geoms get recycled with the same hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RequestPhysicsterseUpdate()
|
||||||
|
{
|
||||||
|
if (PhysEngineToSceneConnectorModule.IsPhysEngineActor)
|
||||||
|
{
|
||||||
|
PhysEngineToSceneConnectorModule.RouteUpdate(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.RequestPhysicsterseUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int PhysicsActorType
|
public override int PhysicsActorType
|
||||||
{
|
{
|
||||||
get { return (int) ActorTypes.Prim; }
|
get { return (int) ActorTypes.Prim; }
|
||||||
|
@ -2641,7 +2655,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
_position = l_position;
|
_position = l_position;
|
||||||
//_parent_scene.remActivePrim(this);
|
//_parent_scene.remActivePrim(this);
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
base.RequestPhysicsterseUpdate();
|
RequestPhysicsterseUpdate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2676,7 +2690,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
m_rotationalVelocity.Z = 0;
|
m_rotationalVelocity.Z = 0;
|
||||||
|
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
base.RequestPhysicsterseUpdate();
|
RequestPhysicsterseUpdate();
|
||||||
|
|
||||||
m_throttleUpdates = false;
|
m_throttleUpdates = false;
|
||||||
throttleCounter = 0;
|
throttleCounter = 0;
|
||||||
|
@ -2729,7 +2743,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
|
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
{
|
{
|
||||||
base.RequestPhysicsterseUpdate();
|
RequestPhysicsterseUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastUpdateSent = true;
|
m_lastUpdateSent = true;
|
||||||
|
@ -2741,7 +2755,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
{
|
{
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
{
|
{
|
||||||
base.RequestPhysicsterseUpdate();
|
RequestPhysicsterseUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2776,7 +2790,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
{
|
{
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
{
|
{
|
||||||
base.RequestPhysicsterseUpdate();
|
RequestPhysicsterseUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -77,6 +77,8 @@ public class PECharacter : PhysicsActor
|
||||||
float capsule_radius, float tensor, float density, float height_fudge_factor,
|
float capsule_radius, float tensor, float density, float height_fudge_factor,
|
||||||
float walk_divisor, float rundivisor)
|
float walk_divisor, float rundivisor)
|
||||||
{
|
{
|
||||||
|
_position = pos;
|
||||||
|
_size = size;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +125,7 @@ public class PECharacter : PhysicsActor
|
||||||
public override Vector3 Position {
|
public override Vector3 Position {
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
set { _position = value;
|
set { _position = value;
|
||||||
// m_log.Debug("[RPE] PEChar set Position");
|
// m_log.DebugFormat("[RPE] PEChar set Position: {0}", _position);
|
||||||
Prop.Set(_localID, PropType.Position, _position);
|
Prop.Set(_localID, PropType.Position, _position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,6 +157,7 @@ public class PECharacter : PhysicsActor
|
||||||
public override Vector3 Velocity {
|
public override Vector3 Velocity {
|
||||||
get { return _velocity; }
|
get { return _velocity; }
|
||||||
set { _velocity = value;
|
set { _velocity = value;
|
||||||
|
m_log.Debug("[RPE] PEChar set Velocity");
|
||||||
Prop.Set(_localID, PropType.Velocity, _velocity);
|
Prop.Set(_localID, PropType.Velocity, _velocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,9 @@ public sealed class PEPrim : PhysicsActor
|
||||||
public PEPrim(String primName, PEScene parent_scene, Vector3 pos, Vector3 size,
|
public PEPrim(String primName, PEScene parent_scene, Vector3 pos, Vector3 size,
|
||||||
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
|
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
|
||||||
{
|
{
|
||||||
|
_position = pos;
|
||||||
|
_size = size;
|
||||||
|
_orientation = rotation;
|
||||||
// SendCreatePrim(primName, parent_scene, pos, size, rotation, mesh, pbs, pisPhysical, dode);
|
// SendCreatePrim(primName, parent_scene, pos, size, rotation, mesh, pbs, pisPhysical, dode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Region.Framework;
|
||||||
|
using OpenSim.Region.CoreModules.RegionSync.RegionSyncModule;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.PEPlugin
|
namespace OpenSim.Region.Physics.PEPlugin
|
||||||
{
|
{
|
||||||
|
@ -98,6 +100,29 @@ public class PEScene : PhysicsScene
|
||||||
|
|
||||||
public override float Simulate(float timeStep)
|
public override float Simulate(float timeStep)
|
||||||
{
|
{
|
||||||
|
// if we are a physics engine server, send update information
|
||||||
|
if (SceneToPhysEngineSyncServer.IsPhysEngineScene2())
|
||||||
|
{
|
||||||
|
if (SceneToPhysEngineSyncServer.IsActivePhysEngineScene2())
|
||||||
|
{
|
||||||
|
// 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))
|
||||||
|
{
|
||||||
|
SceneToPhysEngineSyncServer.RouteUpdate(prim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (PECharacter actor in m_avatars)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[RPE]: Simulate. p={0}, a={1}", m_prims.Count, m_avatars.Count);
|
||||||
|
SceneToPhysEngineSyncServer.RouteUpdate(actor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 60f;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// code borrowed from BasicPhysics to do just avatar movement
|
||||||
foreach (PECharacter actor in m_avatars)
|
foreach (PECharacter actor in m_avatars)
|
||||||
{
|
{
|
||||||
Vector3 actorPosition = actor.Position;
|
Vector3 actorPosition = actor.Position;
|
||||||
|
@ -146,6 +171,7 @@ public class PEScene : PhysicsScene
|
||||||
actor.Position = actorPosition;
|
actor.Position = actorPosition;
|
||||||
actor.Velocity = actorVelocity;
|
actor.Velocity = actorVelocity;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return 60f; // returns frames per second
|
return 60f; // returns frames per second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -534,6 +534,7 @@
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Region.CoreModules"/>
|
<Reference name="OpenSim.Region.CoreModules"/>
|
||||||
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="Ode.NET.dll" />
|
<Reference name="Ode.NET.dll" />
|
||||||
|
@ -565,6 +566,7 @@
|
||||||
<Reference name="OpenMetaverseTypes.dll"/>
|
<Reference name="OpenMetaverseTypes.dll"/>
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
<Reference name="OpenSim.Region.CoreModules"/>
|
<Reference name="OpenSim.Region.CoreModules"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
|
@ -3180,6 +3182,8 @@
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
|
<Reference name="OpenSim.Region.CoreModules"/>
|
||||||
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="Ode.NET.dll" />
|
<Reference name="Ode.NET.dll" />
|
||||||
<Reference name="nunit.framework.dll" />
|
<Reference name="nunit.framework.dll" />
|
||||||
|
|
Loading…
Reference in New Issue