* A Few physical prim + linkset fixes. Prevent some crashes

0.6.1-post-fixes
Teravus Ovares 2008-12-14 06:34:05 +00:00
parent b32f72a438
commit 6f7a560c04
1 changed files with 53 additions and 21 deletions

View File

@ -700,6 +700,17 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodyDestroy(Body); d.BodyDestroy(Body);
lock (childrenPrim)
{
if (childrenPrim.Count > 0)
{
foreach (OdePrim prm in childrenPrim)
{
_parent_scene.remActivePrim(prm);
prm.Body = IntPtr.Zero;
}
}
}
Body = IntPtr.Zero; Body = IntPtr.Zero;
} }
} }
@ -971,6 +982,12 @@ namespace OpenSim.Region.Physics.OdePlugin
prm.m_collisionCategories |= CollisionCategories.Body; prm.m_collisionCategories |= CollisionCategories.Body;
prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
if (prm.prim_geom == IntPtr.Zero)
{
m_log.Warn("[PHYSICS]: Unable to link one of the linkset elements. No geom yet");
continue;
}
d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
@ -1345,7 +1362,9 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (m_isphysical) if (m_isphysical)
{ {
// This is a fallback.. May no longer be necessary.
if (!m_disabled && !m_taintremove && !childPrim)
{
if (Body == IntPtr.Zero) if (Body == IntPtr.Zero)
enableBody(); enableBody();
//Prim auto disable after 20 frames, //Prim auto disable after 20 frames,
@ -1358,7 +1377,10 @@ namespace OpenSim.Region.Physics.OdePlugin
m_linkJoint = IntPtr.Zero; m_linkJoint = IntPtr.Zero;
} }
} }
if (Body != IntPtr.Zero)
{
d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
if (_parent != null) if (_parent != null)
{ {
OdePrim odParent = (OdePrim)_parent; OdePrim odParent = (OdePrim)_parent;
@ -1372,6 +1394,16 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodyEnable(Body); d.BodyEnable(Body);
} }
else else
{
m_log.Warn("[PHYSICS]: Body Still null after enableBody(). This is a crash scenario.");
}
}
//else
// {
//m_log.Debug("[BUG]: race!");
//}
}
else
{ {
// string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position);
// int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);