some cleanup, allow cast rays to collide with terrain within limited range (old ode)
parent
3f4fdacb34
commit
0b36d4ea2f
|
@ -203,7 +203,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
public int m_interpenetrationcount { get; private set; }
|
public int m_interpenetrationcount { get; private set; }
|
||||||
internal float m_collisionscore;
|
internal float m_collisionscore;
|
||||||
public int m_roundsUnderMotionThreshold { get; private set; }
|
public int m_roundsUnderMotionThreshold { get; private set; }
|
||||||
private int m_crossingfailures;
|
|
||||||
|
|
||||||
public bool outofBounds { get; private set; }
|
public bool outofBounds { get; private set; }
|
||||||
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
||||||
|
|
|
@ -175,8 +175,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
// this value may still be too large, depending on machine configuration
|
// this value may still be too large, depending on machine configuration
|
||||||
// of maximum stack
|
// of maximum stack
|
||||||
float len = req.length;
|
float len = req.length;
|
||||||
if (len > 250f)
|
if (len > 100f)
|
||||||
len = 250f;
|
len = 100f;
|
||||||
|
|
||||||
// Create the ray
|
// Create the ray
|
||||||
IntPtr ray = d.CreateRay(m_scene.space, len);
|
IntPtr ray = d.CreateRay(m_scene.space, len);
|
||||||
|
@ -226,8 +226,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
{
|
{
|
||||||
// limit ray length or collisions will take all avaiable stack space
|
// limit ray length or collisions will take all avaiable stack space
|
||||||
float len = req.length;
|
float len = req.length;
|
||||||
if (len > 250f)
|
if (len > 100f)
|
||||||
len = 250f;
|
len = 100f;
|
||||||
|
|
||||||
// Create the ray
|
// Create the ray
|
||||||
IntPtr ray = d.CreateRay(m_scene.space, len);
|
IntPtr ray = d.CreateRay(m_scene.space, len);
|
||||||
|
@ -252,71 +252,10 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
private void near(IntPtr space, IntPtr g1, IntPtr g2)
|
private void near(IntPtr space, IntPtr g1, IntPtr g2)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Don't test against heightfield Geom, or you'll be sorry!
|
|
||||||
|
|
||||||
/*
|
|
||||||
terminate called after throwing an instance of 'std::bad_alloc'
|
|
||||||
what(): std::bad_alloc
|
|
||||||
Stacktrace:
|
|
||||||
|
|
||||||
at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0x00004>
|
|
||||||
at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0xffffffff>
|
|
||||||
at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0x00280>
|
|
||||||
at (wrapper native-to-managed) OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0xfff
|
|
||||||
fffff>
|
|
||||||
at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0x00004>
|
|
||||||
at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0xffffffff>
|
|
||||||
at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.RayCast (OpenSim.Region.Physics.OdePlugin.ODERayCastRequest) <
|
|
||||||
0x00114>
|
|
||||||
at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.ProcessQueuedRequests () <0x000eb>
|
|
||||||
at OpenSim.Region.Physics.OdePlugin.OdeScene.Simulate (single) <0x017e6>
|
|
||||||
at OpenSim.Region.Framework.Scenes.SceneGraph.UpdatePhysics (double) <0x00042>
|
|
||||||
at OpenSim.Region.Framework.Scenes.Scene.Update () <0x0039e>
|
|
||||||
at OpenSim.Region.Framework.Scenes.Scene.Heartbeat (object) <0x00019>
|
|
||||||
at (wrapper runtime-invoke) object.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>
|
|
||||||
|
|
||||||
Native stacktrace:
|
|
||||||
|
|
||||||
mono [0x80d2a42]
|
|
||||||
[0xb7f5840c]
|
|
||||||
/lib/i686/cmov/libc.so.6(abort+0x188) [0xb7d1a018]
|
|
||||||
/usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x158) [0xb45fc988]
|
|
||||||
/usr/lib/libstdc++.so.6 [0xb45fa865]
|
|
||||||
/usr/lib/libstdc++.so.6 [0xb45fa8a2]
|
|
||||||
/usr/lib/libstdc++.so.6 [0xb45fa9da]
|
|
||||||
/usr/lib/libstdc++.so.6(_Znwj+0x83) [0xb45fb033]
|
|
||||||
/usr/lib/libstdc++.so.6(_Znaj+0x1d) [0xb45fb11d]
|
|
||||||
libode.so(_ZN13dxHeightfield23dCollideHeightfieldZoneEiiiiP6dxGeomiiP12dContactGeomi+0xd04) [0xb46678e4]
|
|
||||||
libode.so(_Z19dCollideHeightfieldP6dxGeomS0_iP12dContactGeomi+0x54b) [0xb466832b]
|
|
||||||
libode.so(dCollide+0x102) [0xb46571b2]
|
|
||||||
[0x95cfdec9]
|
|
||||||
[0x8ea07fe1]
|
|
||||||
[0xab260146]
|
|
||||||
libode.so [0xb465a5c4]
|
|
||||||
libode.so(_ZN11dxHashSpace8collide2EPvP6dxGeomPFvS0_S2_S2_E+0x75) [0xb465bcf5]
|
|
||||||
libode.so(dSpaceCollide2+0x177) [0xb465ac67]
|
|
||||||
[0x95cf978e]
|
|
||||||
[0x8ea07945]
|
|
||||||
[0x95cf2bbc]
|
|
||||||
[0xab2787e7]
|
|
||||||
[0xab419fb3]
|
|
||||||
[0xab416657]
|
|
||||||
[0xab415bda]
|
|
||||||
[0xb609b08e]
|
|
||||||
mono(mono_runtime_delegate_invoke+0x34) [0x8192534]
|
|
||||||
mono [0x81a2f0f]
|
|
||||||
mono [0x81d28b6]
|
|
||||||
mono [0x81ea2c6]
|
|
||||||
/lib/i686/cmov/libpthread.so.0 [0xb7e744c0]
|
|
||||||
/lib/i686/cmov/libc.so.6(clone+0x5e) [0xb7dcd6de]
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Exclude heightfield geom
|
|
||||||
|
|
||||||
if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
|
if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
|
||||||
return;
|
return;
|
||||||
if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass)
|
// if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
// Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms.
|
// Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms.
|
||||||
if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
|
if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
|
||||||
|
|
|
@ -58,16 +58,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
End = 2
|
End = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// public struct sCollisionData
|
|
||||||
// {
|
|
||||||
// public uint ColliderLocalId;
|
|
||||||
// public uint CollidedWithLocalId;
|
|
||||||
// public int NumberOfCollisions;
|
|
||||||
// public int CollisionType;
|
|
||||||
// public int StatusIndicator;
|
|
||||||
// public int lastframe;
|
|
||||||
// }
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum CollisionCategories : int
|
public enum CollisionCategories : int
|
||||||
{
|
{
|
||||||
|
@ -323,7 +313,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
public bool IsAvCapsuleTilted { get; private set; }
|
public bool IsAvCapsuleTilted { get; private set; }
|
||||||
|
|
||||||
private float avDensity = 80f;
|
private float avDensity = 80f;
|
||||||
// private float avHeightFudgeFactor = 0.52f;
|
|
||||||
private float avMovementDivisorWalk = 1.3f;
|
private float avMovementDivisorWalk = 1.3f;
|
||||||
private float avMovementDivisorRun = 0.8f;
|
private float avMovementDivisorRun = 0.8f;
|
||||||
private float minimumGroundFlightOffset = 3f;
|
private float minimumGroundFlightOffset = 3f;
|
||||||
|
@ -346,7 +335,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
|
|
||||||
public int bodyFramesAutoDisable = 20;
|
public int bodyFramesAutoDisable = 20;
|
||||||
|
|
||||||
private float[] _watermap;
|
|
||||||
private bool m_filterCollisions = true;
|
private bool m_filterCollisions = true;
|
||||||
|
|
||||||
private d.NearCallback nearCallback;
|
private d.NearCallback nearCallback;
|
||||||
|
@ -457,31 +445,21 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
private d.Contact WaterContact;
|
private d.Contact WaterContact;
|
||||||
private d.Contact[,] m_materialContacts;
|
private d.Contact[,] m_materialContacts;
|
||||||
|
|
||||||
//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
|
|
||||||
//Ckrinke private int m_randomizeWater = 200;
|
|
||||||
private int m_physicsiterations = 10;
|
private int m_physicsiterations = 10;
|
||||||
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
||||||
private readonly PhysicsActor PANull = new NullPhysicsActor();
|
private readonly PhysicsActor PANull = new NullPhysicsActor();
|
||||||
private float step_time = 0.0f;
|
private float step_time = 0.0f;
|
||||||
//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
|
|
||||||
//Ckrinke private int ms = 0;
|
|
||||||
public IntPtr world;
|
public IntPtr world;
|
||||||
//private bool returncollisions = false;
|
|
||||||
// private uint obj1LocalID = 0;
|
|
||||||
private uint obj2LocalID = 0;
|
private uint obj2LocalID = 0;
|
||||||
//private int ctype = 0;
|
|
||||||
private OdeCharacter cc1;
|
private OdeCharacter cc1;
|
||||||
private OdePrim cp1;
|
private OdePrim cp1;
|
||||||
private OdeCharacter cc2;
|
private OdeCharacter cc2;
|
||||||
private OdePrim cp2;
|
private OdePrim cp2;
|
||||||
private int p1ExpectedPoints = 0;
|
private int p1ExpectedPoints = 0;
|
||||||
private int p2ExpectedPoints = 0;
|
private int p2ExpectedPoints = 0;
|
||||||
//private int cStartStop = 0;
|
|
||||||
//private string cDictKey = "";
|
|
||||||
|
|
||||||
public IntPtr space;
|
public IntPtr space;
|
||||||
|
|
||||||
//private IntPtr tmpSpace;
|
|
||||||
// split static geometry collision handling into spaces of 30 meters
|
// split static geometry collision handling into spaces of 30 meters
|
||||||
public IntPtr[,] staticPrimspace;
|
public IntPtr[,] staticPrimspace;
|
||||||
|
|
||||||
|
@ -565,8 +543,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
m_suportCombine = false;
|
m_suportCombine = false;
|
||||||
|
|
||||||
nearCallback = near;
|
nearCallback = near;
|
||||||
// triCallback = TriCallback;
|
|
||||||
// triArrayCallback = TriArrayCallback;
|
|
||||||
m_rayCastManager = new ODERayCastRequestManager(this);
|
m_rayCastManager = new ODERayCastRequestManager(this);
|
||||||
|
|
||||||
// Create the world and the first space
|
// Create the world and the first space
|
||||||
|
@ -576,11 +552,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
contactgroup = d.JointGroupCreate(0);
|
contactgroup = d.JointGroupCreate(0);
|
||||||
|
|
||||||
d.WorldSetAutoDisableFlag(world, false);
|
d.WorldSetAutoDisableFlag(world, false);
|
||||||
|
|
||||||
// _watermap = new float[258 * 258];
|
|
||||||
|
|
||||||
// Zero out the prim spaces array (we split our space into smaller spaces so
|
|
||||||
// we can hit test less.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize from configs
|
// Initialize from configs
|
||||||
|
@ -708,8 +679,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
spaceGridMaxX--;
|
spaceGridMaxX--;
|
||||||
spaceGridMaxY--;
|
spaceGridMaxY--;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Centeral contact friction and bounce
|
// Centeral contact friction and bounce
|
||||||
// ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why
|
// ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why
|
||||||
// an avatar falls through in Z but not in X or Y when walking on a prim.
|
// an avatar falls through in Z but not in X or Y when walking on a prim.
|
||||||
|
@ -884,9 +853,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
d.WorldSetLinearDampingThreshold(world, 256f);
|
d.WorldSetLinearDampingThreshold(world, 256f);
|
||||||
d.WorldSetMaxAngularSpeed(world, 256f);
|
d.WorldSetMaxAngularSpeed(world, 256f);
|
||||||
|
|
||||||
// Set how many steps we go without running collision testing
|
|
||||||
// This is in addition to the step size.
|
|
||||||
// Essentially Steps * m_physicsiterations
|
|
||||||
d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
||||||
//d.WorldSetContactMaxCorrectingVel(world, 1000.0f);
|
//d.WorldSetContactMaxCorrectingVel(world, 1000.0f);
|
||||||
|
|
||||||
|
@ -901,22 +867,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
_worldInitialized = true;
|
_worldInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal void waitForSpaceUnlock(IntPtr space)
|
|
||||||
// {
|
|
||||||
// //if (space != IntPtr.Zero)
|
|
||||||
// //while (d.SpaceLockQuery(space)) { } // Wait and do nothing
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Debug space message for printing the space that a prim/avatar is in.
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="pos"></param>
|
|
||||||
// /// <returns>Returns which split up space the given position is in.</returns>
|
|
||||||
// public string whichspaceamIin(Vector3 pos)
|
|
||||||
// {
|
|
||||||
// return calculateSpaceForGeom(pos).ToString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
#region Collision Detection
|
#region Collision Detection
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1042,12 +992,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
name2 = "null";
|
name2 = "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (id == d.GeomClassId.TriMeshClass)
|
|
||||||
//{
|
|
||||||
// m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2);
|
|
||||||
//m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Figure out how many contact points we have
|
// Figure out how many contact points we have
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -1166,110 +1110,9 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
// we don't want prim or avatar to explode
|
// we don't want prim or avatar to explode
|
||||||
|
|
||||||
#region InterPenetration Handling - Unintended physics explosions
|
#region InterPenetration Handling - Unintended physics explosions
|
||||||
# region disabled code1
|
|
||||||
|
|
||||||
if (curContact.depth >= 0.08f)
|
if (curContact.depth >= 0.08f)
|
||||||
{
|
{
|
||||||
//This is disabled at the moment only because it needs more tweaking
|
|
||||||
//It will eventually be uncommented
|
|
||||||
/*
|
|
||||||
if (contact.depth >= 1.00f)
|
|
||||||
{
|
|
||||||
//m_log.Debug("[PHYSICS]: " + contact.depth.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
//If you interpenetrate a prim with an agent
|
|
||||||
if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
|
|
||||||
p1.PhysicsActorType == (int) ActorTypes.Prim) ||
|
|
||||||
(p1.PhysicsActorType == (int) ActorTypes.Agent &&
|
|
||||||
p2.PhysicsActorType == (int) ActorTypes.Prim))
|
|
||||||
{
|
|
||||||
|
|
||||||
//contact.depth = contact.depth * 4.15f;
|
|
||||||
/*
|
|
||||||
if (p2.PhysicsActorType == (int) ActorTypes.Agent)
|
|
||||||
{
|
|
||||||
p2.CollidingObj = true;
|
|
||||||
contact.depth = 0.003f;
|
|
||||||
p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
|
|
||||||
OdeCharacter character = (OdeCharacter) p2;
|
|
||||||
character.SetPidStatus(true);
|
|
||||||
contact.pos = new d.Vector3(contact.pos.X + (p1.Size.X / 2), contact.pos.Y + (p1.Size.Y / 2), contact.pos.Z + (p1.Size.Z / 2));
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
//contact.depth = 0.0000000f;
|
|
||||||
}
|
|
||||||
if (p1.PhysicsActorType == (int) ActorTypes.Agent)
|
|
||||||
{
|
|
||||||
|
|
||||||
p1.CollidingObj = true;
|
|
||||||
contact.depth = 0.003f;
|
|
||||||
p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
|
|
||||||
contact.pos = new d.Vector3(contact.pos.X + (p2.Size.X / 2), contact.pos.Y + (p2.Size.Y / 2), contact.pos.Z + (p2.Size.Z / 2));
|
|
||||||
OdeCharacter character = (OdeCharacter)p1;
|
|
||||||
character.SetPidStatus(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
//contact.depth = 0.0000000f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// If you interpenetrate a prim with another prim
|
|
||||||
/*
|
|
||||||
if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
|
|
||||||
{
|
|
||||||
#region disabledcode2
|
|
||||||
//OdePrim op1 = (OdePrim)p1;
|
|
||||||
//OdePrim op2 = (OdePrim)p2;
|
|
||||||
//op1.m_collisionscore++;
|
|
||||||
//op2.m_collisionscore++;
|
|
||||||
|
|
||||||
//if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000)
|
|
||||||
//{
|
|
||||||
//op1.m_taintdisable = true;
|
|
||||||
//AddPhysicsActorTaint(p1);
|
|
||||||
//op2.m_taintdisable = true;
|
|
||||||
//AddPhysicsActorTaint(p2);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (contact.depth >= 0.25f)
|
|
||||||
//{
|
|
||||||
// Don't collide, one or both prim will expld.
|
|
||||||
|
|
||||||
//op1.m_interpenetrationcount++;
|
|
||||||
//op2.m_interpenetrationcount++;
|
|
||||||
//interpenetrations_before_disable = 200;
|
|
||||||
//if (op1.m_interpenetrationcount >= interpenetrations_before_disable)
|
|
||||||
//{
|
|
||||||
//op1.m_taintdisable = true;
|
|
||||||
//AddPhysicsActorTaint(p1);
|
|
||||||
//}
|
|
||||||
//if (op2.m_interpenetrationcount >= interpenetrations_before_disable)
|
|
||||||
//{
|
|
||||||
// op2.m_taintdisable = true;
|
|
||||||
//AddPhysicsActorTaint(p2);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//contact.depth = contact.depth / 8f;
|
|
||||||
//contact.normal = new d.Vector3(0, 0, 1);
|
|
||||||
//}
|
|
||||||
//if (op1.m_disabled || op2.m_disabled)
|
|
||||||
//{
|
|
||||||
//Manually disabled objects stay disabled
|
|
||||||
//contact.depth = 0f;
|
|
||||||
//}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
if (curContact.depth >= 1.00f)
|
if (curContact.depth >= 1.00f)
|
||||||
{
|
{
|
||||||
//m_log.Info("[P]: " + contact.depth.ToString());
|
//m_log.Info("[P]: " + contact.depth.ToString());
|
||||||
|
@ -1584,12 +1427,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
}
|
}
|
||||||
else if (at == ActorTypes.Prim)
|
else if (at == ActorTypes.Prim)
|
||||||
{
|
{
|
||||||
//d.AABB aabb1 = new d.AABB();
|
|
||||||
//d.AABB aabb2 = new d.AABB();
|
|
||||||
|
|
||||||
//d.GeomGetAABB(contactGeom.g2, out aabb2);
|
|
||||||
//d.GeomGetAABB(contactGeom.g1, out aabb1);
|
|
||||||
//aabb1.
|
|
||||||
if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)))
|
if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)))
|
||||||
{
|
{
|
||||||
if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z)
|
if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z)
|
||||||
|
@ -1631,14 +1468,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
cc1 = (OdeCharacter)p1;
|
cc1 = (OdeCharacter)p1;
|
||||||
obj2LocalID = cc1.LocalID;
|
obj2LocalID = cc1.LocalID;
|
||||||
cc1.AddCollisionEvent(cc2.LocalID, contact);
|
cc1.AddCollisionEvent(cc2.LocalID, contact);
|
||||||
//ctype = (int)CollisionCategories.Character;
|
|
||||||
|
|
||||||
//if (cc1.CollidingObj)
|
|
||||||
//cStartStop = (int)StatusIndicators.Generic;
|
|
||||||
//else
|
|
||||||
//cStartStop = (int)StatusIndicators.Start;
|
|
||||||
|
|
||||||
//returncollisions = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActorTypes.Prim:
|
case ActorTypes.Prim:
|
||||||
|
@ -1648,21 +1477,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
obj2LocalID = cp1.LocalID;
|
obj2LocalID = cp1.LocalID;
|
||||||
cp1.AddCollisionEvent(cc2.LocalID, contact);
|
cp1.AddCollisionEvent(cc2.LocalID, contact);
|
||||||
}
|
}
|
||||||
//ctype = (int)CollisionCategories.Geom;
|
|
||||||
|
|
||||||
//if (cp1.CollidingObj)
|
|
||||||
//cStartStop = (int)StatusIndicators.Generic;
|
|
||||||
//else
|
|
||||||
//cStartStop = (int)StatusIndicators.Start;
|
|
||||||
|
|
||||||
//returncollisions = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActorTypes.Ground:
|
case ActorTypes.Ground:
|
||||||
case ActorTypes.Unknown:
|
case ActorTypes.Unknown:
|
||||||
obj2LocalID = 0;
|
obj2LocalID = 0;
|
||||||
//ctype = (int)CollisionCategories.Land;
|
|
||||||
//returncollisions = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1684,13 +1503,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
cc1 = (OdeCharacter) p1;
|
cc1 = (OdeCharacter) p1;
|
||||||
obj2LocalID = cc1.LocalID;
|
obj2LocalID = cc1.LocalID;
|
||||||
cc1.AddCollisionEvent(cp2.LocalID, contact);
|
cc1.AddCollisionEvent(cp2.LocalID, contact);
|
||||||
//ctype = (int)CollisionCategories.Character;
|
|
||||||
|
|
||||||
//if (cc1.CollidingObj)
|
|
||||||
//cStartStop = (int)StatusIndicators.Generic;
|
|
||||||
//else
|
|
||||||
//cStartStop = (int)StatusIndicators.Start;
|
|
||||||
//returncollisions = true;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ActorTypes.Prim:
|
case ActorTypes.Prim:
|
||||||
|
@ -1700,23 +1512,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
cp1 = (OdePrim) p1;
|
cp1 = (OdePrim) p1;
|
||||||
obj2LocalID = cp1.LocalID;
|
obj2LocalID = cp1.LocalID;
|
||||||
cp1.AddCollisionEvent(cp2.LocalID, contact);
|
cp1.AddCollisionEvent(cp2.LocalID, contact);
|
||||||
//ctype = (int)CollisionCategories.Geom;
|
|
||||||
|
|
||||||
//if (cp1.CollidingObj)
|
|
||||||
//cStartStop = (int)StatusIndicators.Generic;
|
|
||||||
//else
|
|
||||||
//cStartStop = (int)StatusIndicators.Start;
|
|
||||||
|
|
||||||
//returncollisions = true;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActorTypes.Ground:
|
case ActorTypes.Ground:
|
||||||
case ActorTypes.Unknown:
|
case ActorTypes.Unknown:
|
||||||
obj2LocalID = 0;
|
obj2LocalID = 0;
|
||||||
//ctype = (int)CollisionCategories.Land;
|
|
||||||
|
|
||||||
//returncollisions = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1724,80 +1525,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//if (returncollisions)
|
|
||||||
//{
|
|
||||||
|
|
||||||
//lock (m_storedCollisions)
|
|
||||||
//{
|
|
||||||
//cDictKey = obj1LocalID.ToString() + obj2LocalID.ToString() + cStartStop.ToString() + ctype.ToString();
|
|
||||||
//if (m_storedCollisions.ContainsKey(cDictKey))
|
|
||||||
//{
|
|
||||||
//sCollisionData objd = m_storedCollisions[cDictKey];
|
|
||||||
//objd.NumberOfCollisions += 1;
|
|
||||||
//objd.lastframe = framecount;
|
|
||||||
//m_storedCollisions[cDictKey] = objd;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
//sCollisionData objd = new sCollisionData();
|
|
||||||
//objd.ColliderLocalId = obj1LocalID;
|
|
||||||
//objd.CollidedWithLocalId = obj2LocalID;
|
|
||||||
//objd.CollisionType = ctype;
|
|
||||||
//objd.NumberOfCollisions = 1;
|
|
||||||
//objd.lastframe = framecount;
|
|
||||||
//objd.StatusIndicator = cStartStop;
|
|
||||||
//m_storedCollisions.Add(cDictKey, objd);
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
private int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount)
|
|
||||||
{
|
|
||||||
String name1 = null;
|
|
||||||
String name2 = null;
|
|
||||||
|
|
||||||
if (!geom_name_map.TryGetValue(trimesh, out name1))
|
|
||||||
{
|
|
||||||
name1 = "null";
|
|
||||||
}
|
|
||||||
if (!geom_name_map.TryGetValue(refObject, out name2))
|
|
||||||
{
|
|
||||||
name2 = "null";
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.InfoFormat("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex)
|
|
||||||
{
|
|
||||||
// String name1 = null;
|
|
||||||
// String name2 = null;
|
|
||||||
//
|
|
||||||
// if (!geom_name_map.TryGetValue(trimesh, out name1))
|
|
||||||
// {
|
|
||||||
// name1 = "null";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!geom_name_map.TryGetValue(refObject, out name2))
|
|
||||||
// {
|
|
||||||
// name2 = "null";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// m_log.InfoFormat("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex);
|
|
||||||
|
|
||||||
d.Vector3 v0 = new d.Vector3();
|
|
||||||
d.Vector3 v1 = new d.Vector3();
|
|
||||||
d.Vector3 v2 = new d.Vector3();
|
|
||||||
|
|
||||||
d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2);
|
|
||||||
// m_log.DebugFormat("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is our collision testing routine in ODE
|
/// This is our collision testing routine in ODE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2988,26 +2716,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
|
|
||||||
lock (OdeLock)
|
lock (OdeLock)
|
||||||
{
|
{
|
||||||
// Process 10 frames if the sim is running normal..
|
|
||||||
// process 5 frames if the sim is running slow
|
|
||||||
//try
|
|
||||||
//{
|
|
||||||
//d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
|
||||||
//}
|
|
||||||
//catch (StackOverflowException)
|
|
||||||
//{
|
|
||||||
// m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
|
|
||||||
// ode.drelease(world);
|
|
||||||
//base.TriggerPhysicsBasedRestart();
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Figure out the Frames Per Second we're going at.
|
|
||||||
//(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
|
|
||||||
|
|
||||||
|
|
||||||
// HACK: Using a time dilation of 1.0 to debug rubberbanding issues
|
|
||||||
//m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f);
|
|
||||||
|
|
||||||
while (step_time > HalfOdeStep)
|
while (step_time > HalfOdeStep)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -3107,10 +2815,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
tempTick = tempTick2;
|
tempTick = tempTick2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ((framecount % m_randomizeWater) == 0)
|
|
||||||
// randomizeWater(waterlevel);
|
|
||||||
|
|
||||||
//int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests();
|
|
||||||
m_rayCastManager.ProcessQueuedRequests();
|
m_rayCastManager.ProcessQueuedRequests();
|
||||||
|
|
||||||
if (CollectStats)
|
if (CollectStats)
|
||||||
|
@ -3131,7 +2835,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
|
|
||||||
foreach (PhysicsActor obj in m_collisionEventActors.Values)
|
foreach (PhysicsActor obj in m_collisionEventActors.Values)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID);
|
// m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID);
|
||||||
|
|
||||||
switch ((ActorTypes)obj.PhysicsActorType)
|
switch ((ActorTypes)obj.PhysicsActorType)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue