* A hacky attempt at resolving mantis #4260. I think ODE was unable to allocate memory, and therefore the unmanaged wrapper call fails or worse.. there's some unmanaged resource accounting in the ODEPlugin for ODECharacter that isn't being done properly now.

* The broken avatar may not be able to move, but it won't stop simulate from pressing on now.   And, the simulator will try to destroy the avatar's physics proxy and recreate it again...    but if this is what I think it is, it may not help.
prioritization
Teravus Ovares (Dan Olivares) 2009-10-16 03:32:30 -04:00
parent 9ddf598e54
commit ac2f98b846
2 changed files with 31 additions and 2 deletions

View File

@ -3410,11 +3410,20 @@ namespace OpenSim.Region.Framework.Scenes
scene.AddPhysicsActorTaint(m_physicsActor);
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
m_physicsActor.SubscribeEvents(500);
m_physicsActor.LocalID = LocalId;
}
private void OutOfBoundsCall(PhysicsVector pos)
{
bool flying = m_physicsActor.Flying;
RemoveFromPhysicalScene();
AddToPhysicalScene(flying);
}
// Event called by the physics plugin to tell the avatar about a collision.
private void PhysicsCollisionUpdate(EventArgs e)
{

View File

@ -1105,7 +1105,18 @@ namespace OpenSim.Region.Physics.OdePlugin
public void UpdatePositionAndVelocity()
{
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
d.Vector3 vec = d.BodyGetPosition(Body);
d.Vector3 vec;
try
{
vec = d.BodyGetPosition(Body);
//throw new NullReferenceException("foo!");
}
catch (NullReferenceException)
{
vec = new d.Vector3(Position.X, Position.Y, Position.Z);
base.RaiseOutOfBounds(_position);
}
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
if (vec.X < 0.0f) vec.X = 0.0f;
@ -1137,7 +1148,16 @@ namespace OpenSim.Region.Physics.OdePlugin
else
{
m_lastUpdateSent = false;
try
{
vec = d.BodyGetLinearVel(Body);
}
catch (NullReferenceException)
{
vec.X = _velocity.X;
vec.Y = _velocity.Y;
vec.Z = _velocity.Z;
}
_velocity.X = (vec.X);
_velocity.Y = (vec.Y);