In propagating PhysicsCollision event across actors, sending the list of UUIDs
of collision objects, instead of localIDs. llVolumeDetect() now seems working, at least with integrated physics.dsg
parent
c3c566cd24
commit
1cca4a978d
|
@ -2134,7 +2134,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
private void HandleRemoteEvent_PhysicsCollision(string actorID, ulong evSeqNum, OSDMap data)
|
private void HandleRemoteEvent_PhysicsCollision(string actorID, ulong evSeqNum, OSDMap data)
|
||||||
{
|
{
|
||||||
UUID primUUID = data["primUUID"].AsUUID();
|
UUID primUUID = data["primUUID"].AsUUID();
|
||||||
OSDArray collisionLocalIDs = (OSDArray)data["collisionLocalIDs"];
|
//OSDArray collisionLocalIDs = (OSDArray)data["collisionLocalIDs"];
|
||||||
|
OSDArray collisionUUIDs = (OSDArray)data["collisionUUIDs"];
|
||||||
|
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(primUUID);
|
SceneObjectPart part = m_scene.GetSceneObjectPart(primUUID);
|
||||||
if (part == null)
|
if (part == null)
|
||||||
|
@ -2142,7 +2143,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no part with UUID {1} found", LogHeader, primUUID);
|
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no part with UUID {1} found", LogHeader, primUUID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (collisionLocalIDs == null)
|
if (collisionUUIDs == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no collisionLocalIDs", LogHeader);
|
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no collisionLocalIDs", LogHeader);
|
||||||
return;
|
return;
|
||||||
|
@ -2150,10 +2151,37 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
// Build up the collision list. The contact point is ignored so we generate some default.
|
// Build up the collision list. The contact point is ignored so we generate some default.
|
||||||
CollisionEventUpdate e = new CollisionEventUpdate();
|
CollisionEventUpdate e = new CollisionEventUpdate();
|
||||||
|
/*
|
||||||
foreach (uint collisionID in collisionLocalIDs)
|
foreach (uint collisionID in collisionLocalIDs)
|
||||||
{
|
{
|
||||||
// e.addCollider(collisionID, new ContactPoint());
|
// e.addCollider(collisionID, new ContactPoint());
|
||||||
e.addCollider(collisionID, new ContactPoint(Vector3.Zero, Vector3.UnitX, 0.03f));
|
e.addCollider(collisionID, new ContactPoint(Vector3.Zero, Vector3.UnitX, 0.03f));
|
||||||
|
}
|
||||||
|
* */
|
||||||
|
for(int i=0; i<collisionUUIDs.Count; i++)
|
||||||
|
{
|
||||||
|
OSD arg = collisionUUIDs[i];
|
||||||
|
UUID collidingUUID = arg.AsUUID();
|
||||||
|
|
||||||
|
SceneObjectPart collidingPart = m_scene.GetSceneObjectPart(collidingUUID);
|
||||||
|
if (collidingPart == null)
|
||||||
|
{
|
||||||
|
//collision object is not a prim, check if it's an avatar
|
||||||
|
ScenePresence sp = m_scene.GetScenePresence(collidingUUID);
|
||||||
|
if (sp == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("Received collision event for SOP {0},{1} with another SOP {2}, but the latter is not found in local Scene",
|
||||||
|
part.Name, part.UUID, collidingUUID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.addCollider(sp.LocalId, new ContactPoint(Vector3.Zero, Vector3.UnitX, 0.03f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.addCollider(collidingPart.LocalId, new ContactPoint(Vector3.Zero, Vector3.UnitX, 0.03f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part.PhysicsCollisionLocally(e);
|
part.PhysicsCollisionLocally(e);
|
||||||
}
|
}
|
||||||
|
@ -2277,6 +2305,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
SendSceneEvent(SymmetricSyncMessage.MsgType.Attach, data);
|
SendSceneEvent(SymmetricSyncMessage.MsgType.Attach, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private void OnLocalPhysicsCollision(UUID partUUID, OSDArray collisionLocalIDs)
|
private void OnLocalPhysicsCollision(UUID partUUID, OSDArray collisionLocalIDs)
|
||||||
{
|
{
|
||||||
OSDMap data = new OSDMap();
|
OSDMap data = new OSDMap();
|
||||||
|
@ -2284,6 +2313,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
data["collisionLocalIDs"] = collisionLocalIDs;
|
data["collisionLocalIDs"] = collisionLocalIDs;
|
||||||
SendSceneEvent(SymmetricSyncMessage.MsgType.PhysicsCollision, data);
|
SendSceneEvent(SymmetricSyncMessage.MsgType.PhysicsCollision, data);
|
||||||
}
|
}
|
||||||
|
* */
|
||||||
|
private void OnLocalPhysicsCollision(UUID partUUID, OSDArray collisionUUIDs)
|
||||||
|
{
|
||||||
|
OSDMap data = new OSDMap();
|
||||||
|
data["primUUID"] = OSD.FromUUID(partUUID);
|
||||||
|
data["collisionUUIDs"] = collisionUUIDs;
|
||||||
|
SendSceneEvent(SymmetricSyncMessage.MsgType.PhysicsCollision, data);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
|
private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
|
||||||
{
|
{
|
||||||
|
@ -5716,7 +5753,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SceneObjectPartSyncProperties.VolumeDetectActive:
|
case SceneObjectPartSyncProperties.VolumeDetectActive:
|
||||||
//part.ParentGroup.UpdatePrimFlagsBySync(part.LocalId, part., IsTemporary, IsPhantom, part.VolumeDetectActive);
|
//part.ParentGroup.UpdatePrimFlagsBySync(part.LocalId, part., IsTemporary, IsPhantom, part.VolumeDetectActive);
|
||||||
bool isVD = (bool)pSyncInfo.LastUpdateValue;
|
bool isVD = (bool)pSyncInfo.LastUpdateValue;
|
||||||
DebugLog.DebugFormat("VolumeDetectActive updated on SOP {0}, to {1}", part.Name, part.VolumeDetectActive);
|
DebugLog.DebugFormat("VolumeDetectActive updated on SOP {0}, to {1}", part.Name, isVD);
|
||||||
if (part.ParentGroup != null)
|
if (part.ParentGroup != null)
|
||||||
{
|
{
|
||||||
DebugLog.DebugFormat("calling ScriptSetVolumeDetectBySync");
|
DebugLog.DebugFormat("calling ScriptSetVolumeDetectBySync");
|
||||||
|
|
|
@ -5247,14 +5247,41 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
CollisionEventUpdate a = (CollisionEventUpdate)e;
|
CollisionEventUpdate a = (CollisionEventUpdate)e;
|
||||||
Dictionary<uint, ContactPoint> collisionswith = a.m_objCollisionList;
|
Dictionary<uint, ContactPoint> collisionswith = a.m_objCollisionList;
|
||||||
|
/*
|
||||||
OSDArray collisionLocalIDs = new OSDArray();
|
OSDArray collisionLocalIDs = new OSDArray();
|
||||||
foreach (uint collisionObject in collisionswith.Keys)
|
foreach (uint collisionObject in collisionswith.Keys)
|
||||||
{
|
{
|
||||||
collisionLocalIDs.Add(collisionObject);
|
collisionLocalIDs.Add(collisionObject);
|
||||||
|
}
|
||||||
|
* */
|
||||||
|
OSDArray collisionUUIDs = new OSDArray();
|
||||||
|
foreach (uint collisionObject in collisionswith.Keys)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = m_parentGroup.Scene.GetSceneObjectPart(collisionObject);
|
||||||
|
if (part == null)
|
||||||
|
{
|
||||||
|
//collisionObject not a prim in local Scene, check if it's an avatar
|
||||||
|
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(collisionObject);
|
||||||
|
|
||||||
|
if (sp == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("PhysicsCollision: {0},{1} is informed to be collided with {2}(localID), but the latter prim/avatar is not found in local Scene",
|
||||||
|
Name, UUID, collisionObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
collisionUUIDs.Add(OSD.FromUUID(sp.UUID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
collisionUUIDs.Add(OSD.FromUUID(part.UUID));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
object[] eventArgs = new object[2];
|
object[] eventArgs = new object[2];
|
||||||
eventArgs[0] = this.UUID;
|
eventArgs[0] = this.UUID;
|
||||||
eventArgs[1] = collisionLocalIDs;
|
//eventArgs[1] = collisionLocalIDs;
|
||||||
|
eventArgs[1] = collisionUUIDs;
|
||||||
m_parentGroup.Scene.RegionSyncModule.PublishSceneEvent(EventManager.EventNames.PhysicsCollision, eventArgs);
|
m_parentGroup.Scene.RegionSyncModule.PublishSceneEvent(EventManager.EventNames.PhysicsCollision, eventArgs);
|
||||||
}
|
}
|
||||||
PhysicsCollisionLocally(e);
|
PhysicsCollisionLocally(e);
|
||||||
|
@ -5433,7 +5460,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (pa == null)
|
if (pa == null)
|
||||||
{
|
{
|
||||||
//DSG DEBUG
|
//DSG DEBUG
|
||||||
m_log.DebugFormat("Creating PhysActor for SOP {0}, {1}, so far Flags = ", Name, UUID, Flags.ToString());
|
m_log.DebugFormat("Creating PhysActor for SOP {0}, {1}, so far Flags = {2}", Name, UUID, Flags.ToString());
|
||||||
|
|
||||||
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
|
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
|
||||||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||||
|
@ -5533,7 +5560,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
//ScheduleFullUpdate();
|
//ScheduleFullUpdate();
|
||||||
|
|
||||||
m_log.DebugFormat("End of UpdatePrimFlagsBySync for SOP {0}, {1}, so far Flags = ", Name, UUID, Flags.ToString());
|
m_log.DebugFormat("End of UpdatePrimFlagsBySync for SOP {0}, {1}, so far Flags = {2}", Name, UUID, Flags.ToString());
|
||||||
|
|
||||||
//caller will trigger this, See SetSOPFlags()
|
//caller will trigger this, See SetSOPFlags()
|
||||||
//ScheduleFullUpdate(null);
|
//ScheduleFullUpdate(null);
|
||||||
|
|
Loading…
Reference in New Issue