* 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) 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; && (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 // 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()) 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 // 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 (contacts[i].depth >= 0.08f) if (contacts[i].depth >= 0.08f)
{ {
//This is disabled at the moment only because it needs more tweaking //This is disabled at the moment only because it needs more tweaking
//It will eventually be uncommented //It will eventually be uncommented
/*
if (contacts[i].depth >= 1.00f) if (contacts[i].depth >= 1.00f)
{ {
//m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString()); //m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString());
@ -854,7 +855,7 @@ namespace OpenSim.Region.Physics.OdePlugin
(p1.PhysicsActorType == (int) ActorTypes.Agent && (p1.PhysicsActorType == (int) ActorTypes.Agent &&
p2.PhysicsActorType == (int) ActorTypes.Prim)) p2.PhysicsActorType == (int) ActorTypes.Prim))
{ {
# region disabled code1
//contacts[i].depth = contacts[i].depth * 4.15f; //contacts[i].depth = contacts[i].depth * 4.15f;
/* /*
if (p2.PhysicsActorType == (int) ActorTypes.Agent) if (p2.PhysicsActorType == (int) ActorTypes.Agent)
@ -887,11 +888,13 @@ namespace OpenSim.Region.Physics.OdePlugin
//contacts[i].depth = 0.0000000f; //contacts[i].depth = 0.0000000f;
} }
*/
#endregion
} }
*/
// If you interpenetrate a prim with another prim // If you interpenetrate a prim with another prim
/*
if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
{ {
#region disabledcode2 #region disabledcode2
@ -936,7 +939,8 @@ namespace OpenSim.Region.Physics.OdePlugin
//} //}
#endregion #endregion
} }
*/
#endregion
if (contacts[i].depth >= 1.00f) if (contacts[i].depth >= 1.00f)
{ {
//m_log.Info("[P]: " + contacts[i].depth.ToString()); //m_log.Info("[P]: " + contacts[i].depth.ToString());
@ -947,37 +951,37 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (p2.PhysicsActorType == (int) ActorTypes.Agent) if (p2.PhysicsActorType == (int) ActorTypes.Agent)
{ {
OdeCharacter character = (OdeCharacter) p2; if (p2 is OdeCharacter)
{
OdeCharacter character = (OdeCharacter) p2;
//p2.CollidingObj = true; //p2.CollidingObj = true;
contacts[i].depth = 0.00000003f; contacts[i].depth = 0.00000003f;
p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f);
contacts[i].pos = contacts[i].pos =
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
contacts[i].pos.Y + (p1.Size.Y/2), contacts[i].pos.Y + (p1.Size.Y/2),
contacts[i].pos.Z + (p1.Size.Z/2)); contacts[i].pos.Z + (p1.Size.Z/2));
character.SetPidStatus(true); character.SetPidStatus(true);
} }
else
{
} }
if (p1.PhysicsActorType == (int) ActorTypes.Agent) if (p1.PhysicsActorType == (int) ActorTypes.Agent)
{ {
OdeCharacter character = (OdeCharacter)p1; if (p1 is OdeCharacter)
{
OdeCharacter character = (OdeCharacter) p1;
//p2.CollidingObj = true; //p2.CollidingObj = true;
contacts[i].depth = 0.00000003f; contacts[i].depth = 0.00000003f;
p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f); p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f);
contacts[i].pos = contacts[i].pos =
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
contacts[i].pos.Y + (p1.Size.Y/2), contacts[i].pos.Y + (p1.Size.Y/2),
contacts[i].pos.Z + (p1.Size.Z/2)); contacts[i].pos.Z + (p1.Size.Z/2));
character.SetPidStatus(true); character.SetPidStatus(true);
} }
else
{
//contacts[i].depth = 0.0000000f;
} }
} }
} }
@ -1045,12 +1049,16 @@ namespace OpenSim.Region.Physics.OdePlugin
// prim prim contact // prim prim contact
// int pj294950 = 0; // int pj294950 = 0;
int movintYN = 0; int movintYN = 0;
int material = (int) Material.Wood;
// prim terrain contact // prim terrain contact
if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f) if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)
{ {
movintYN = 1; movintYN = 1;
} }
int material = ((OdePrim)p2).m_material;
if (p2 is OdePrim)
material = ((OdePrim)p2).m_material;
//m_log.DebugFormat("Material: {0}", material); //m_log.DebugFormat("Material: {0}", material);
m_materialContacts[material, movintYN].geom = contacts[i]; m_materialContacts[material, movintYN].geom = contacts[i];
_perloopContact.Add(contacts[i]); _perloopContact.Add(contacts[i]);
@ -1072,7 +1080,11 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
movintYN = 1; 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_log.DebugFormat("Material: {0}", material);
m_materialContacts[material, movintYN].geom = contacts[i]; m_materialContacts[material, movintYN].geom = contacts[i];
_perloopContact.Add(contacts[i]); _perloopContact.Add(contacts[i]);
@ -1151,7 +1163,10 @@ namespace OpenSim.Region.Physics.OdePlugin
else if (p2.PhysicsActorType == (int)ActorTypes.Prim) else if (p2.PhysicsActorType == (int)ActorTypes.Prim)
{ {
//p1.PhysicsActorType //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_log.DebugFormat("Material: {0}", material);
m_materialContacts[material, 0].geom = contacts[i]; m_materialContacts[material, 0].geom = contacts[i];
@ -1289,9 +1304,12 @@ namespace OpenSim.Region.Physics.OdePlugin
//returncollisions = true; //returncollisions = true;
break; break;
case ActorTypes.Prim: case ActorTypes.Prim:
cp1 = (OdePrim)p1; if (p1 is OdePrim)
obj2LocalID = cp1.m_localID; {
cp1.AddCollisionEvent(cc2.m_localID, collisiondepth); cp1 = (OdePrim) p1;
obj2LocalID = cp1.m_localID;
cp1.AddCollisionEvent(cc2.m_localID, collisiondepth);
}
//ctype = (int)CollisionCategories.Geom; //ctype = (int)CollisionCategories.Geom;
//if (cp1.CollidingObj) //if (cp1.CollidingObj)
@ -1313,48 +1331,58 @@ namespace OpenSim.Region.Physics.OdePlugin
cc2.AddCollisionEvent(obj2LocalID, collisiondepth); cc2.AddCollisionEvent(obj2LocalID, collisiondepth);
break; break;
case ActorTypes.Prim: case ActorTypes.Prim:
cp2 = (OdePrim)p2;
// obj1LocalID = cp2.m_localID; if (p2 is OdePrim)
switch ((ActorTypes)p1.PhysicsActorType)
{ {
case ActorTypes.Agent: cp2 = (OdePrim) p2;
cc1 = (OdeCharacter)p1;
obj2LocalID = cc1.m_localID;
cc1.AddCollisionEvent(cp2.m_localID, collisiondepth);
//ctype = (int)CollisionCategories.Character;
//if (cc1.CollidingObj) // obj1LocalID = cp2.m_localID;
//cStartStop = (int)StatusIndicators.Generic; switch ((ActorTypes) p1.PhysicsActorType)
//else {
//cStartStop = (int)StatusIndicators.Start; case ActorTypes.Agent:
//returncollisions = true; if (p1 is OdeCharacter)
{
cc1 = (OdeCharacter) p1;
obj2LocalID = cc1.m_localID;
cc1.AddCollisionEvent(cp2.m_localID, collisiondepth);
//ctype = (int)CollisionCategories.Character;
break; //if (cc1.CollidingObj)
case ActorTypes.Prim: //cStartStop = (int)StatusIndicators.Generic;
cp1 = (OdePrim)p1; //else
obj2LocalID = cp1.m_localID; //cStartStop = (int)StatusIndicators.Start;
cp1.AddCollisionEvent(cp2.m_localID, collisiondepth); //returncollisions = true;
//ctype = (int)CollisionCategories.Geom; }
break;
case ActorTypes.Prim:
//if (cp1.CollidingObj) if (p1 is OdePrim)
//cStartStop = (int)StatusIndicators.Generic; {
//else cp1 = (OdePrim) p1;
//cStartStop = (int)StatusIndicators.Start; obj2LocalID = cp1.m_localID;
cp1.AddCollisionEvent(cp2.m_localID, collisiondepth);
//ctype = (int)CollisionCategories.Geom;
//returncollisions = true; //if (cp1.CollidingObj)
break; //cStartStop = (int)StatusIndicators.Generic;
//else
//cStartStop = (int)StatusIndicators.Start;
case ActorTypes.Ground: //returncollisions = true;
case ActorTypes.Unknown: }
obj2LocalID = 0; break;
//ctype = (int)CollisionCategories.Land;
//returncollisions = true; case ActorTypes.Ground:
break; case ActorTypes.Unknown:
obj2LocalID = 0;
//ctype = (int)CollisionCategories.Land;
//returncollisions = true;
break;
}
cp2.AddCollisionEvent(obj2LocalID, collisiondepth);
} }
cp2.AddCollisionEvent(obj2LocalID, collisiondepth);
break; break;
} }
//if (returncollisions) //if (returncollisions)