Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim

prioritization
Melanie 2009-10-16 13:29:07 +01:00
commit 5de657cf5d
2 changed files with 33 additions and 2 deletions

View File

@ -908,6 +908,7 @@ namespace OpenSim.Region.Framework.Scenes
if (PhysicsActor != null)
{
m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
m_physicsActor.OnOutOfBounds -= OutOfBoundsCall;
m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
m_physicsActor.UnSubscribeEvents();
m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
@ -3410,11 +3411,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,19 @@ 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);
}
catch (NullReferenceException)
{
vec = new d.Vector3(_position.X, _position.Y, _position.Z);
base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar: {0}", m_name);
}
// 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 +1149,16 @@ namespace OpenSim.Region.Physics.OdePlugin
else
{
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.Y = (vec.Y);