move characters (avatars) to own collision space, also fixing a problem
with previus code that was still assuming the avatar is g2avinationmerge
parent
fc1be7e41f
commit
b6d29aa124
|
@ -708,21 +708,21 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
bot += midsz;
|
bot += midsz;
|
||||||
float topz = bot + topsz * 0.5f;
|
float topz = bot + topsz * 0.5f;
|
||||||
|
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.CharsSpace);
|
||||||
|
|
||||||
feetbox = d.CreateBox(_parent_scene.ActiveSpace, feetsx, feetsy, feetsz);
|
feetbox = d.CreateBox(_parent_scene.CharsSpace, feetsx, feetsy, feetsz);
|
||||||
d.GeomSetCategoryBits(feetbox, (uint)m_collisionCategories);
|
d.GeomSetCategoryBits(feetbox, (uint)m_collisionCategories);
|
||||||
d.GeomSetCollideBits(feetbox, (uint)m_collisionFlags);
|
d.GeomSetCollideBits(feetbox, (uint)m_collisionFlags);
|
||||||
|
|
||||||
midbox = d.CreateBox(_parent_scene.ActiveSpace, midsx, midsy, midsz);
|
midbox = d.CreateBox(_parent_scene.CharsSpace, midsx, midsy, midsz);
|
||||||
d.GeomSetCategoryBits(midbox, (uint)m_collisionCategories);
|
d.GeomSetCategoryBits(midbox, (uint)m_collisionCategories);
|
||||||
d.GeomSetCollideBits(midbox, (uint)m_collisionFlags);
|
d.GeomSetCollideBits(midbox, (uint)m_collisionFlags);
|
||||||
|
|
||||||
topbox = d.CreateBox(_parent_scene.ActiveSpace, topsx, topsy, topsz);
|
topbox = d.CreateBox(_parent_scene.CharsSpace, topsx, topsy, topsz);
|
||||||
d.GeomSetCategoryBits(topbox, (uint)m_collisionCategories);
|
d.GeomSetCategoryBits(topbox, (uint)m_collisionCategories);
|
||||||
d.GeomSetCollideBits(topbox, (uint)m_collisionFlags);
|
d.GeomSetCollideBits(topbox, (uint)m_collisionFlags);
|
||||||
|
|
||||||
bonebox = d.CreateBox(_parent_scene.ActiveSpace, bonesx, bonesy, bonesz);
|
bonebox = d.CreateBox(_parent_scene.CharsSpace, bonesx, bonesy, bonesz);
|
||||||
d.GeomSetCategoryBits(bonebox, (uint)m_collisionCategories);
|
d.GeomSetCategoryBits(bonebox, (uint)m_collisionCategories);
|
||||||
d.GeomSetCollideBits(bonebox, (uint)m_collisionFlags);
|
d.GeomSetCollideBits(bonebox, (uint)m_collisionFlags);
|
||||||
|
|
||||||
|
@ -828,21 +828,21 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (topbox != IntPtr.Zero)
|
if (topbox != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_parent_scene.actor_name_map.Remove(topbox);
|
_parent_scene.actor_name_map.Remove(topbox);
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.CharsSpace);
|
||||||
d.GeomDestroy(topbox);
|
d.GeomDestroy(topbox);
|
||||||
topbox = IntPtr.Zero;
|
topbox = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
if (midbox != IntPtr.Zero)
|
if (midbox != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_parent_scene.actor_name_map.Remove(midbox);
|
_parent_scene.actor_name_map.Remove(midbox);
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.CharsSpace);
|
||||||
d.GeomDestroy(midbox);
|
d.GeomDestroy(midbox);
|
||||||
midbox = IntPtr.Zero;
|
midbox = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
if (feetbox != IntPtr.Zero)
|
if (feetbox != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_parent_scene.actor_name_map.Remove(feetbox);
|
_parent_scene.actor_name_map.Remove(feetbox);
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.CharsSpace);
|
||||||
d.GeomDestroy(feetbox);
|
d.GeomDestroy(feetbox);
|
||||||
feetbox = IntPtr.Zero;
|
feetbox = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (bonebox != IntPtr.Zero)
|
if (bonebox != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_parent_scene.actor_name_map.Remove(bonebox);
|
_parent_scene.actor_name_map.Remove(bonebox);
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.CharsSpace);
|
||||||
d.GeomDestroy(bonebox);
|
d.GeomDestroy(bonebox);
|
||||||
bonebox = IntPtr.Zero;
|
bonebox = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
// Collide tests
|
// Collide tests
|
||||||
if ((CurrentRayFilter & FilterActiveSpace) != 0)
|
if ((CurrentRayFilter & FilterActiveSpace) != 0)
|
||||||
|
{
|
||||||
d.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
|
||||||
|
d.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback);
|
||||||
|
}
|
||||||
if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
|
if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
|
||||||
d.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
|
||||||
if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
|
if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
|
||||||
|
|
|
@ -299,6 +299,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
public IntPtr TopSpace; // the global space
|
public IntPtr TopSpace; // the global space
|
||||||
public IntPtr ActiveSpace; // space for active prims
|
public IntPtr ActiveSpace; // space for active prims
|
||||||
|
public IntPtr CharsSpace; // space for active prims
|
||||||
public IntPtr StaticSpace; // space for the static things around
|
public IntPtr StaticSpace; // space for the static things around
|
||||||
public IntPtr GroundSpace; // space for ground
|
public IntPtr GroundSpace; // space for ground
|
||||||
|
|
||||||
|
@ -372,21 +373,25 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
// now the major subspaces
|
// now the major subspaces
|
||||||
ActiveSpace = d.HashSpaceCreate(TopSpace);
|
ActiveSpace = d.HashSpaceCreate(TopSpace);
|
||||||
|
CharsSpace = d.HashSpaceCreate(TopSpace);
|
||||||
StaticSpace = d.HashSpaceCreate(TopSpace);
|
StaticSpace = d.HashSpaceCreate(TopSpace);
|
||||||
GroundSpace = d.HashSpaceCreate(TopSpace);
|
GroundSpace = d.HashSpaceCreate(TopSpace);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// i must RtC#FM
|
// i must RtC#FM
|
||||||
|
// i did!
|
||||||
}
|
}
|
||||||
|
|
||||||
d.HashSpaceSetLevels(TopSpace, -2, 8);
|
d.HashSpaceSetLevels(TopSpace, -2, 8);
|
||||||
d.HashSpaceSetLevels(ActiveSpace, -2, 8);
|
d.HashSpaceSetLevels(ActiveSpace, -2, 8);
|
||||||
|
d.HashSpaceSetLevels(CharsSpace, -4, 3);
|
||||||
d.HashSpaceSetLevels(StaticSpace, -2, 8);
|
d.HashSpaceSetLevels(StaticSpace, -2, 8);
|
||||||
d.HashSpaceSetLevels(GroundSpace, 0, 8);
|
d.HashSpaceSetLevels(GroundSpace, 0, 8);
|
||||||
|
|
||||||
// demote to second level
|
// demote to second level
|
||||||
d.SpaceSetSublevel(ActiveSpace, 1);
|
d.SpaceSetSublevel(ActiveSpace, 1);
|
||||||
|
d.SpaceSetSublevel(CharsSpace, 1);
|
||||||
d.SpaceSetSublevel(StaticSpace, 1);
|
d.SpaceSetSublevel(StaticSpace, 1);
|
||||||
d.SpaceSetSublevel(GroundSpace, 1);
|
d.SpaceSetSublevel(GroundSpace, 1);
|
||||||
|
|
||||||
|
@ -396,11 +401,24 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
CollisionCategories.Phantom |
|
CollisionCategories.Phantom |
|
||||||
CollisionCategories.VolumeDtc
|
CollisionCategories.VolumeDtc
|
||||||
));
|
));
|
||||||
d.GeomSetCollideBits(ActiveSpace, 0);
|
d.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space |
|
||||||
|
CollisionCategories.Geom |
|
||||||
|
CollisionCategories.Character |
|
||||||
|
CollisionCategories.Phantom |
|
||||||
|
CollisionCategories.VolumeDtc
|
||||||
|
));
|
||||||
|
d.GeomSetCategoryBits(CharsSpace, (uint)(CollisionCategories.Space |
|
||||||
|
CollisionCategories.Geom |
|
||||||
|
CollisionCategories.Character |
|
||||||
|
CollisionCategories.Phantom |
|
||||||
|
CollisionCategories.VolumeDtc
|
||||||
|
));
|
||||||
|
d.GeomSetCollideBits(CharsSpace, 0);
|
||||||
|
|
||||||
d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space |
|
d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space |
|
||||||
CollisionCategories.Geom |
|
CollisionCategories.Geom |
|
||||||
CollisionCategories.Land |
|
// CollisionCategories.Land |
|
||||||
CollisionCategories.Water |
|
// CollisionCategories.Water |
|
||||||
CollisionCategories.Phantom |
|
CollisionCategories.Phantom |
|
||||||
CollisionCategories.VolumeDtc
|
CollisionCategories.VolumeDtc
|
||||||
));
|
));
|
||||||
|
@ -1271,6 +1289,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.SpaceCollide2(StaticSpace, chr.midbox, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(StaticSpace, chr.midbox, IntPtr.Zero, nearCallback);
|
||||||
d.SpaceCollide2(StaticSpace, chr.feetbox, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(StaticSpace, chr.feetbox, IntPtr.Zero, nearCallback);
|
||||||
d.SpaceCollide2(StaticSpace, chr.bonebox, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(StaticSpace, chr.bonebox, IntPtr.Zero, nearCallback);
|
||||||
|
|
||||||
|
// chars with chars
|
||||||
|
d.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback);
|
||||||
// no coll with gnd
|
// no coll with gnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1312,16 +1333,25 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_log.Warn("[PHYSICS]: Unable to collide Active prim to static space");
|
m_log.Warn("[PHYSICS]: Unable to collide Active prim to static space");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// finally colide active things amoung them
|
// colide active amoung them
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback);
|
d.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback);
|
||||||
}
|
}
|
||||||
catch (AccessViolationException)
|
catch (AccessViolationException)
|
||||||
|
{
|
||||||
|
m_log.Warn("[PHYSICS]: Unable to collide Active with Characters space");
|
||||||
|
}
|
||||||
|
// and with chars
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d.SpaceCollide2(ActiveSpace, CharsSpace,IntPtr.Zero, nearCallback);
|
||||||
|
}
|
||||||
|
catch (AccessViolationException)
|
||||||
{
|
{
|
||||||
m_log.Warn("[PHYSICS]: Unable to collide in Active space");
|
m_log.Warn("[PHYSICS]: Unable to collide in Active space");
|
||||||
}
|
}
|
||||||
// _perloopContact.Clear();
|
// _perloopContact.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in New Issue