Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
commit
944f2c57fa
|
@ -4098,6 +4098,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
|
||||
{
|
||||
/*
|
||||
lock(m_collisionEventLock)
|
||||
{
|
||||
if (m_collisionEventFlag)
|
||||
|
@ -4107,6 +4108,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
Util.FireAndForget(delegate(object x)
|
||||
{
|
||||
*/
|
||||
try
|
||||
{
|
||||
List<uint> thisHitColliders = new List<uint>();
|
||||
|
@ -4286,7 +4288,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
m_collisionEventFlag = false;
|
||||
}
|
||||
});
|
||||
// });
|
||||
}
|
||||
|
||||
private void TeleportFlagsDebug() {
|
||||
|
|
|
@ -128,9 +128,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
public d.Mass ShellMass;
|
||||
// public bool collidelock = false;
|
||||
|
||||
private bool m_haseventsubscription = false;
|
||||
public int m_eventsubscription = 0;
|
||||
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
private int m_cureventsubscription = 0;
|
||||
private CollisionEventUpdate CollisionEventsThisFrame = null;
|
||||
private bool SentEmptyCollisionsEvent;
|
||||
|
||||
// unique UUID of this character object
|
||||
public UUID m_uuid;
|
||||
|
@ -1120,47 +1121,72 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
m_requestedUpdateFrequency = ms;
|
||||
m_eventsubscription = ms;
|
||||
_parent_scene.AddCollisionEventReporting(this);
|
||||
m_haseventsubscription = true;
|
||||
m_cureventsubscription = 0;
|
||||
if (CollisionEventsThisFrame == null)
|
||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
SentEmptyCollisionsEvent = false;
|
||||
}
|
||||
|
||||
public override void UnSubscribeEvents()
|
||||
{
|
||||
m_haseventsubscription = false;
|
||||
_parent_scene.RemoveCollisionEventReporting(this);
|
||||
m_requestedUpdateFrequency = 0;
|
||||
if (CollisionEventsThisFrame != null)
|
||||
{
|
||||
CollisionEventsThisFrame.Clear();
|
||||
CollisionEventsThisFrame = null;
|
||||
}
|
||||
m_eventsubscription = 0;
|
||||
}
|
||||
|
||||
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
||||
{
|
||||
if (m_haseventsubscription)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[PHYSICS]: Adding collision event for {0}, collidedWith {1}, contact {2}", "", CollidedWith, contact);
|
||||
|
||||
if (CollisionEventsThisFrame == null)
|
||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendCollisions()
|
||||
{
|
||||
if (m_haseventsubscription && m_eventsubscription > m_requestedUpdateFrequency)
|
||||
{
|
||||
if (CollisionEventsThisFrame != null)
|
||||
if (CollisionEventsThisFrame == null)
|
||||
return;
|
||||
|
||||
if (m_cureventsubscription < m_eventsubscription)
|
||||
return;
|
||||
|
||||
m_cureventsubscription = 0;
|
||||
|
||||
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
|
||||
|
||||
if (!SentEmptyCollisionsEvent || ncolisions > 0)
|
||||
{
|
||||
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
||||
|
||||
if (ncolisions == 0)
|
||||
{
|
||||
SentEmptyCollisionsEvent = true;
|
||||
_parent_scene.RemoveCollisionEventReporting(this);
|
||||
}
|
||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
m_eventsubscription = 0;
|
||||
else
|
||||
{
|
||||
SentEmptyCollisionsEvent = false;
|
||||
CollisionEventsThisFrame.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddCollisionFrameTime(int t)
|
||||
{
|
||||
// protect it from overflow crashing
|
||||
if (m_cureventsubscription + t >= int.MaxValue)
|
||||
m_cureventsubscription = 0;
|
||||
m_cureventsubscription += t;
|
||||
}
|
||||
|
||||
public override bool SubscribedEvents()
|
||||
{
|
||||
return m_haseventsubscription;
|
||||
if (m_eventsubscription > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void changePhysicsStatus(bool NewStatus)
|
||||
|
@ -1466,14 +1492,5 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
_parent_scene.AddChange((PhysicsActor)this, what, arg);
|
||||
}
|
||||
|
||||
|
||||
internal void AddCollisionFrameTime(int p)
|
||||
{
|
||||
// protect it from overflow crashing
|
||||
if (m_eventsubscription + p >= int.MaxValue)
|
||||
m_eventsubscription = 0;
|
||||
m_eventsubscription += p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -937,12 +937,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (CollisionEventsThisFrame == null)
|
||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
SentEmptyCollisionsEvent = false;
|
||||
_parent_scene.AddCollisionEventReporting(this);
|
||||
}
|
||||
|
||||
public override void UnSubscribeEvents()
|
||||
{
|
||||
_parent_scene.RemoveCollisionEventReporting(this);
|
||||
if (CollisionEventsThisFrame != null)
|
||||
{
|
||||
CollisionEventsThisFrame.Clear();
|
||||
|
@ -975,7 +973,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
||||
|
||||
if (ncolisions == 0)
|
||||
{
|
||||
SentEmptyCollisionsEvent = true;
|
||||
_parent_scene.RemoveCollisionEventReporting(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
SentEmptyCollisionsEvent = false;
|
||||
|
|
|
@ -247,6 +247,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// A list of actors that should receive collision events.
|
||||
/// </summary>
|
||||
private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
|
||||
private readonly List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
|
||||
|
||||
private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
||||
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
|
||||
|
@ -1073,6 +1074,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (!(p2events || p1events))
|
||||
return;
|
||||
|
||||
if (p1events)
|
||||
AddCollisionEventReporting(p1);
|
||||
|
||||
if (p2events)
|
||||
AddCollisionEventReporting(p2);
|
||||
|
||||
Vector3 vel = Vector3.Zero;
|
||||
if (p2 != null && p2.IsPhysical)
|
||||
vel = p2.Velocity;
|
||||
|
@ -1255,21 +1262,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add actor to the list that should receive collision events in the simulate loop.
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public void AddCollisionEventReporting(PhysicsActor obj)
|
||||
{
|
||||
lock (_collisionEventPrim)
|
||||
{
|
||||
if (!_collisionEventPrim.Contains(obj))
|
||||
_collisionEventPrim.Add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove actor from the list that should receive collision events in the simulate loop.
|
||||
|
@ -1277,13 +1278,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// <param name="obj"></param>
|
||||
public void RemoveCollisionEventReporting(PhysicsActor obj)
|
||||
{
|
||||
lock (_collisionEventPrim)
|
||||
{
|
||||
if (_collisionEventPrim.Contains(obj))
|
||||
_collisionEventPrim.Remove(obj);
|
||||
}
|
||||
if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj))
|
||||
_collisionEventPrimRemove.Add(obj);
|
||||
}
|
||||
|
||||
|
||||
#region Add/Remove Entities
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
|
@ -1472,6 +1471,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
// lock (OdeLock)
|
||||
{
|
||||
|
||||
OdePrim p = (OdePrim)prim;
|
||||
p.setPrimForRemoval();
|
||||
}
|
||||
|
@ -1890,8 +1890,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
collision_optimized();
|
||||
|
||||
lock (_collisionEventPrim)
|
||||
{
|
||||
foreach (PhysicsActor obj in _collisionEventPrim)
|
||||
{
|
||||
if (obj == null)
|
||||
|
@ -1915,7 +1913,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PhysicsActor obj in _collisionEventPrimRemove)
|
||||
_collisionEventPrim.Remove(obj);
|
||||
|
||||
_collisionEventPrimRemove.Clear();
|
||||
|
||||
// do a ode simulation step
|
||||
d.WorldQuickStep(world, ODE_STEPSIZE);
|
||||
|
|
Loading…
Reference in New Issue