bug fix, and make Mesh-Mesh and Mesh-Terrain collisions a lot softer
parent
9ec9eee75f
commit
7deaad7368
|
@ -633,18 +633,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
#region Collision Detection
|
#region Collision Detection
|
||||||
|
|
||||||
// sets a global contact for a joint for contactgeom , and base contact description)
|
// sets a global contact for a joint for contactgeom , and base contact description)
|
||||||
|
private IntPtr CreateContacJoint(ref d.ContactGeom contactGeom,bool smooth)
|
||||||
|
|
||||||
|
|
||||||
private IntPtr CreateContacJoint(ref d.ContactGeom contactGeom)
|
|
||||||
{
|
{
|
||||||
if (m_global_contactcount >= maxContactsbeforedeath)
|
if (m_global_contactcount >= maxContactsbeforedeath)
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
|
|
||||||
m_global_contactcount++;
|
m_global_contactcount++;
|
||||||
|
if(smooth)
|
||||||
|
SharedTmpcontact.geom.depth = contactGeom.depth * 0.05f;
|
||||||
|
else
|
||||||
SharedTmpcontact.geom.depth = contactGeom.depth;
|
SharedTmpcontact.geom.depth = contactGeom.depth;
|
||||||
SharedTmpcontact.geom.pos = contactGeom.pos;
|
SharedTmpcontact.geom.pos = contactGeom.pos;
|
||||||
|
SharedTmpcontact.geom.pos = contactGeom.pos;
|
||||||
SharedTmpcontact.geom.normal = contactGeom.normal;
|
SharedTmpcontact.geom.normal = contactGeom.normal;
|
||||||
|
|
||||||
IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(m_global_contactcount * d.Contact.unmanagedSizeOf));
|
IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(m_global_contactcount * d.Contact.unmanagedSizeOf));
|
||||||
|
@ -836,6 +836,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
bool dop1ava = false;
|
bool dop1ava = false;
|
||||||
bool dop2ava = false;
|
bool dop2ava = false;
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
|
bool smoothMesh = false;
|
||||||
|
|
||||||
switch (p1.PhysicsActorType)
|
switch (p1.PhysicsActorType)
|
||||||
{
|
{
|
||||||
|
@ -879,6 +880,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (relVlenSQ > 0.01f)
|
if (relVlenSQ > 0.01f)
|
||||||
mu *= frictionMovementMult;
|
mu *= frictionMovementMult;
|
||||||
|
|
||||||
|
if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass &&
|
||||||
|
d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
|
||||||
|
smoothMesh = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ActorTypes.Ground:
|
case (int)ActorTypes.Ground:
|
||||||
|
@ -889,13 +893,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f)
|
if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f)
|
||||||
mu *= frictionMovementMult;
|
mu *= frictionMovementMult;
|
||||||
p1.CollidingGround = true;
|
p1.CollidingGround = true;
|
||||||
/*
|
|
||||||
if(d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
|
if(d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
|
||||||
{
|
smoothMesh = true;
|
||||||
if (curContact.side1 > 0)
|
|
||||||
IgnoreNegSides = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ActorTypes.Water:
|
case (int)ActorTypes.Water:
|
||||||
|
@ -919,6 +919,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f)
|
if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f)
|
||||||
mu *= frictionMovementMult;
|
mu *= frictionMovementMult;
|
||||||
|
|
||||||
|
if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass)
|
||||||
|
smoothMesh = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ignore = true;
|
ignore = true;
|
||||||
|
@ -951,10 +954,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
bool useAltcontact = false;
|
bool useAltcontact = false;
|
||||||
bool noskip = true;
|
bool noskip = true;
|
||||||
|
|
||||||
|
if(dop1ava || dop2ava)
|
||||||
|
smoothMesh = false;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// if (!(IgnoreNegSides && curContact.side1 < 0))
|
|
||||||
{
|
|
||||||
noskip = true;
|
noskip = true;
|
||||||
useAltcontact = false;
|
useAltcontact = false;
|
||||||
|
|
||||||
|
@ -992,9 +996,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (noskip)
|
if (noskip)
|
||||||
{
|
{
|
||||||
if(useAltcontact)
|
if(useAltcontact)
|
||||||
Joint = CreateContacJoint(ref altContact);
|
Joint = CreateContacJoint(ref altContact,smoothMesh);
|
||||||
else
|
else
|
||||||
Joint = CreateContacJoint(ref curContact);
|
Joint = CreateContacJoint(ref curContact,smoothMesh);
|
||||||
|
|
||||||
if (Joint == IntPtr.Zero)
|
if (Joint == IntPtr.Zero)
|
||||||
break;
|
break;
|
||||||
|
@ -1020,7 +1024,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
minDepthContact.SurfaceNormal.Z = curContact.normal.Z;
|
minDepthContact.SurfaceNormal.Z = curContact.normal.Z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (++i >= count)
|
if (++i >= count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1148,12 +1152,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
aprim.CollisionScore = 0;
|
aprim.CollisionScore = 0;
|
||||||
aprim.IsColliding = false;
|
aprim.IsColliding = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
lock (_activeprims)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (OdePrim aprim in _activeprims)
|
foreach (OdePrim aprim in _activegroups)
|
||||||
{
|
{
|
||||||
if(d.BodyIsEnabled(aprim.Body))
|
if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body))
|
||||||
{
|
{
|
||||||
d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
|
||||||
d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
|
||||||
|
|
Loading…
Reference in New Issue