* 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
parent
9ddf598e54
commit
ac2f98b846
|
@ -3410,11 +3410,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
scene.AddPhysicsActorTaint(m_physicsActor);
|
scene.AddPhysicsActorTaint(m_physicsActor);
|
||||||
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||||
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
||||||
|
m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
|
||||||
m_physicsActor.SubscribeEvents(500);
|
m_physicsActor.SubscribeEvents(500);
|
||||||
m_physicsActor.LocalID = LocalId;
|
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.
|
// Event called by the physics plugin to tell the avatar about a collision.
|
||||||
private void PhysicsCollisionUpdate(EventArgs e)
|
private void PhysicsCollisionUpdate(EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1105,7 +1105,18 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
public void UpdatePositionAndVelocity()
|
public void UpdatePositionAndVelocity()
|
||||||
{
|
{
|
||||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
// 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!)
|
// 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;
|
if (vec.X < 0.0f) vec.X = 0.0f;
|
||||||
|
@ -1137,7 +1148,16 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
vec = d.BodyGetLinearVel(Body);
|
try
|
||||||
|
{
|
||||||
|
vec = d.BodyGetLinearVel(Body);
|
||||||
|
}
|
||||||
|
catch (NullReferenceException)
|
||||||
|
{
|
||||||
|
vec.X = _velocity.X;
|
||||||
|
vec.Y = _velocity.Y;
|
||||||
|
vec.Z = _velocity.Z;
|
||||||
|
}
|
||||||
_velocity.X = (vec.X);
|
_velocity.X = (vec.X);
|
||||||
_velocity.Y = (vec.Y);
|
_velocity.Y = (vec.Y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue