* Fixed a case where a prim was a NullPhysicsActor instead of an OdePrim

* Commented logic that wasn't being used.
* This should fix the errors in OdeScene.near
trunk
Teravus Ovares 2009-07-21 03:18:19 +00:00
parent 8af7d5b368
commit 5c8fe5c01c
2 changed files with 99 additions and 71 deletions

View File

@ -1219,7 +1219,7 @@ namespace OpenSim.Region.Framework.Scenes
m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f)
&& (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
//m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto);
// Raycast from the avatar's head to the camera to see if there's anything blocking the view
if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast())
{

View File

@ -837,12 +837,13 @@ namespace OpenSim.Region.Physics.OdePlugin
// we don't want prim or avatar to explode
#region InterPenetration Handling - Unintended physics explosions
# region disabled code1
if (contacts[i].depth >= 0.08f)
{
//This is disabled at the moment only because it needs more tweaking
//It will eventually be uncommented
/*
if (contacts[i].depth >= 1.00f)
{
//m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString());
@ -854,7 +855,7 @@ namespace OpenSim.Region.Physics.OdePlugin
(p1.PhysicsActorType == (int) ActorTypes.Agent &&
p2.PhysicsActorType == (int) ActorTypes.Prim))
{
# region disabled code1
//contacts[i].depth = contacts[i].depth * 4.15f;
/*
if (p2.PhysicsActorType == (int) ActorTypes.Agent)
@ -887,11 +888,13 @@ namespace OpenSim.Region.Physics.OdePlugin
//contacts[i].depth = 0.0000000f;
}
*/
#endregion
}
}
*/
// If you interpenetrate a prim with another prim
/*
if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
{
#region disabledcode2
@ -936,7 +939,8 @@ namespace OpenSim.Region.Physics.OdePlugin
//}
#endregion
}
*/
#endregion
if (contacts[i].depth >= 1.00f)
{
//m_log.Info("[P]: " + contacts[i].depth.ToString());
@ -946,6 +950,8 @@ namespace OpenSim.Region.Physics.OdePlugin
p2.PhysicsActorType == (int) ActorTypes.Unknown))
{
if (p2.PhysicsActorType == (int) ActorTypes.Agent)
{
if (p2 is OdeCharacter)
{
OdeCharacter character = (OdeCharacter) p2;
@ -958,11 +964,12 @@ namespace OpenSim.Region.Physics.OdePlugin
contacts[i].pos.Z + (p1.Size.Z/2));
character.SetPidStatus(true);
}
else
{
}
if (p1.PhysicsActorType == (int) ActorTypes.Agent)
{
if (p1 is OdeCharacter)
{
OdeCharacter character = (OdeCharacter) p1;
@ -975,9 +982,6 @@ namespace OpenSim.Region.Physics.OdePlugin
contacts[i].pos.Z + (p1.Size.Z/2));
character.SetPidStatus(true);
}
else
{
//contacts[i].depth = 0.0000000f;
}
}
}
@ -1045,12 +1049,16 @@ namespace OpenSim.Region.Physics.OdePlugin
// prim prim contact
// int pj294950 = 0;
int movintYN = 0;
int material = (int) Material.Wood;
// prim terrain contact
if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)
{
movintYN = 1;
}
int material = ((OdePrim)p2).m_material;
if (p2 is OdePrim)
material = ((OdePrim)p2).m_material;
//m_log.DebugFormat("Material: {0}", material);
m_materialContacts[material, movintYN].geom = contacts[i];
_perloopContact.Add(contacts[i]);
@ -1072,7 +1080,11 @@ namespace OpenSim.Region.Physics.OdePlugin
{
movintYN = 1;
}
int material = ((OdePrim)p2).m_material;
int material = (int)Material.Wood;
if (p2 is OdePrim)
material = ((OdePrim)p2).m_material;
//m_log.DebugFormat("Material: {0}", material);
m_materialContacts[material, movintYN].geom = contacts[i];
_perloopContact.Add(contacts[i]);
@ -1151,7 +1163,10 @@ namespace OpenSim.Region.Physics.OdePlugin
else if (p2.PhysicsActorType == (int)ActorTypes.Prim)
{
//p1.PhysicsActorType
int material = ((OdePrim)p2).m_material;
int material = (int)Material.Wood;
if (p2 is OdePrim)
material = ((OdePrim)p2).m_material;
//m_log.DebugFormat("Material: {0}", material);
m_materialContacts[material, 0].geom = contacts[i];
@ -1289,9 +1304,12 @@ namespace OpenSim.Region.Physics.OdePlugin
//returncollisions = true;
break;
case ActorTypes.Prim:
if (p1 is OdePrim)
{
cp1 = (OdePrim) p1;
obj2LocalID = cp1.m_localID;
cp1.AddCollisionEvent(cc2.m_localID, collisiondepth);
}
//ctype = (int)CollisionCategories.Geom;
//if (cp1.CollidingObj)
@ -1313,12 +1331,17 @@ namespace OpenSim.Region.Physics.OdePlugin
cc2.AddCollisionEvent(obj2LocalID, collisiondepth);
break;
case ActorTypes.Prim:
if (p2 is OdePrim)
{
cp2 = (OdePrim) p2;
// obj1LocalID = cp2.m_localID;
switch ((ActorTypes) p1.PhysicsActorType)
{
case ActorTypes.Agent:
if (p1 is OdeCharacter)
{
cc1 = (OdeCharacter) p1;
obj2LocalID = cc1.m_localID;
cc1.AddCollisionEvent(cp2.m_localID, collisiondepth);
@ -1329,9 +1352,12 @@ namespace OpenSim.Region.Physics.OdePlugin
//else
//cStartStop = (int)StatusIndicators.Start;
//returncollisions = true;
}
break;
case ActorTypes.Prim:
if (p1 is OdePrim)
{
cp1 = (OdePrim) p1;
obj2LocalID = cp1.m_localID;
cp1.AddCollisionEvent(cp2.m_localID, collisiondepth);
@ -1343,6 +1369,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//cStartStop = (int)StatusIndicators.Start;
//returncollisions = true;
}
break;
case ActorTypes.Ground:
@ -1355,6 +1382,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
cp2.AddCollisionEvent(obj2LocalID, collisiondepth);
}
break;
}
//if (returncollisions)