In collisions report linksets root parts to parts, and not all parts.

Temporary suspend collision checks on full stopped bodies, until a better
away is found wake them, avoiding spurius collision end and start events.
Until a nice way is found to avoid them, this may cause some higher cpu load. plus some clean up
avinationmerge
UbitUmarov 2012-07-13 23:57:45 +01:00
parent 39262f6232
commit 72e2b94094
4 changed files with 45 additions and 41 deletions

View File

@ -95,7 +95,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool m_iscollidingObj = false;
private bool m_alwaysRun = false;
private int m_requestedUpdateFrequency = 0;
public uint m_localID = 0;
private uint m_localID = 0;
public bool m_returnCollisions = false;
// taints and their non-tainted counterparts
public bool m_isPhysical = false; // the current physical status
@ -214,6 +214,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override uint LocalID
{
get { return m_localID; }
set { m_localID = value; }
}

View File

@ -101,7 +101,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private float m_invTimeStep = 50.0f;
private float m_timeStep = .02f;
private Vector3 m_PIDTarget;
private float m_PIDTau;
private bool m_usePID;
@ -119,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
private int body_autodisable_frames = 5;
private int bodydisablecontrol = 0;
public int bodydisablecontrol = 0;
// Default we're a Geometry
@ -144,7 +143,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public bool m_disabled;
public uint m_localID;
private uint m_localID;
private IMesh m_mesh;
private object m_meshlock = new object();
@ -167,7 +166,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// private bool m_throttleUpdates;
// private int throttleCounter;
public float m_collisionscore;
int m_colliderfilter = 0;
private int m_colliderfilter = 0;
public IntPtr collide_geom; // for objects: geom if single prim space it linkset
@ -235,7 +234,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
public override bool Phantom // this is not reliable for internal use
{
get { return m_fakeisphantom; }
@ -292,15 +290,19 @@ namespace OpenSim.Region.Physics.OdePlugin
}
public override uint LocalID
{
get { return m_localID; }
set { m_localID = value; }
}
public OdePrim Parent
{
get
{
return m_localID;
}
set
{
//m_log.Info("[PHYSICS]: Setting TrackerID: " + value);
m_localID = value;
if (childPrim)
return (OdePrim)_parent;
else
return this;
}
}
@ -945,8 +947,7 @@ namespace OpenSim.Region.Physics.OdePlugin
CollisionEventsThisFrame = null;
}
m_eventsubscription = 0;
// for now still done on odescene
// _parent_scene.RemoveCollisionEventReporting(this);
_parent_scene.RemoveCollisionEventReporting(this);
}
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
@ -980,10 +981,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
if (ncolisions > 10)
{
}
SentEmptyCollisionsEvent = false;
CollisionEventsThisFrame.Clear();
}
@ -1832,8 +1829,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
}
}
_parent_scene.addActiveGroups(this);
}
@ -3700,6 +3696,8 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodySetAngularVel(Body, 0, 0, 0);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
disableBodySoft(); // stop collisions
UnSubscribeEvents();
base.RequestPhysicsterseUpdate();
return;
}
@ -3871,8 +3869,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_vehicle = null;
RemoveGeom();
m_targetSpace = IntPtr.Zero;
if (m_eventsubscription > 0)
UnSubscribeEvents();
UnSubscribeEvents();
return true;
case changes.Link:

View File

@ -509,14 +509,14 @@ namespace OpenSim.Region.Physics.OdePlugin
if ((thisFlags & CurrentRayFilter) == 0)
return;
ID = ((OdePrim)p2).m_localID;
ID = ((OdePrim)p2).LocalID;
}
else if (p2 is OdeCharacter)
{
if ((CurrentRayFilter & RayFilterFlags.agent) == 0)
return;
else
ID = ((OdeCharacter)p2).m_localID;
ID = ((OdeCharacter)p2).LocalID;
}
else //??
return;

View File

@ -1171,6 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin
OdePrim cp1;
OdeCharacter cc2;
OdePrim cp2;
OdePrim cp1Parent;
OdePrim cp2Parent;
uint obj2LocalID = 0;
bool p1events = p1.SubscribedEvents();
@ -1207,18 +1209,19 @@ namespace OpenSim.Region.Physics.OdePlugin
{
case ActorTypes.Agent:
cc2 = (OdeCharacter)p2;
obj2LocalID = cc2.m_localID;
obj2LocalID = cc2.LocalID;
if (p2events)
cc2.AddCollisionEvent(cc1.m_localID, contact);
cc2.AddCollisionEvent(cc1.LocalID, contact);
break;
case ActorTypes.Prim:
if (p2 is OdePrim)
{
cp2 = (OdePrim)p2;
obj2LocalID = cp2.m_localID;
if (p2events)
cp2.AddCollisionEvent(cc1.m_localID, contact);
cp2.AddCollisionEvent(cc1.LocalID, contact);
cp2 = cp2.Parent;
obj2LocalID = cp2.LocalID;
}
break;
@ -1240,17 +1243,16 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1 is OdePrim)
{
cp1 = (OdePrim)p1;
// obj1LocalID = cp2.m_localID;
cp1Parent = cp1.Parent;
switch ((ActorTypes)p2.PhysicsActorType)
{
case ActorTypes.Agent:
if (p2 is OdeCharacter)
{
cc2 = (OdeCharacter)p2;
obj2LocalID = cc2.m_localID;
obj2LocalID = cc2.LocalID;
if (p2events)
cc2.AddCollisionEvent(cp1.m_localID, contact);
cc2.AddCollisionEvent(cp1Parent.LocalID, contact);
}
break;
case ActorTypes.Prim:
@ -1258,9 +1260,10 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p2 is OdePrim)
{
cp2 = (OdePrim)p2;
obj2LocalID = cp2.m_localID;
if (p2events)
cp2.AddCollisionEvent(cp1.m_localID, contact);
cp2.AddCollisionEvent(cp1Parent.LocalID, contact);
cp2 = cp2.Parent;
obj2LocalID = cp2.LocalID;
}
break;
@ -1286,7 +1289,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p2 is OdeCharacter)
{
cc2 = (OdeCharacter)p2;
obj2LocalID = cc2.m_localID;
obj2LocalID = cc2.LocalID;
if (p2events)
cc2.AddCollisionEvent(0, contact);
}
@ -1295,7 +1298,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p2 is OdePrim)
{
cp2 = (OdePrim)p2;
obj2LocalID = cp2.m_localID;
obj2LocalID = cp2.LocalID;
if (p2events)
cp2.AddCollisionEvent(0, contact);
}
@ -1350,8 +1353,11 @@ namespace OpenSim.Region.Physics.OdePlugin
{
foreach (OdePrim prm in _activegroups)
{
if (d.BodyIsEnabled(prm.Body) && !prm.m_outbounds)
d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback);
if (!prm.m_outbounds)
{
// if (d.BodyIsEnabled(prm.Body))
d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback);
}
}
}
catch (AccessViolationException)
@ -1604,7 +1610,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName);
lock (prim)
{
RemoveCollisionEventReporting(prim);
// RemoveCollisionEventReporting(prim);
lock (_prims)
_prims.Remove(prim);
}
@ -2012,6 +2018,7 @@ namespace OpenSim.Region.Physics.OdePlugin
case ActorTypes.Prim:
OdePrim pobj = (OdePrim)obj;
if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds))
if (!pobj.m_outbounds)
{
pobj.AddCollisionFrameTime((int)(odetimestepMS));
pobj.SendCollisions();
@ -2728,7 +2735,6 @@ namespace OpenSim.Region.Physics.OdePlugin
WaterMapHandler.Free();
}
if (ContactgeomsArray != IntPtr.Zero)
Marshal.FreeHGlobal(ContactgeomsArray);
if (GlobalContactsArray != IntPtr.Zero)
@ -2751,7 +2757,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (prm.CollisionScore > 0)
{
returncolliders.Add(prm.m_localID, prm.CollisionScore);
returncolliders.Add(prm.LocalID, prm.CollisionScore);
cnt++;
prm.CollisionScore = 0f;
if (cnt > 25)