aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2009-10-16 13:29:07 +0100
committerMelanie2009-10-16 13:29:07 +0100
commit5de657cf5dad49553aeecda90f9cfbc51a5cbece (patch)
treea18777208f04d3e8fbe80666fa6ed823ce9b47c0 /OpenSim/Region
parentThank you, Fly man, for plumbing the AvatarInterestsUpdate packet (diff)
parent* Make sure to unregister the OutOfBounds Physics event in RemoveFromPhysical... (diff)
downloadopensim-SC-5de657cf5dad49553aeecda90f9cfbc51a5cbece.zip
opensim-SC-5de657cf5dad49553aeecda90f9cfbc51a5cbece.tar.gz
opensim-SC-5de657cf5dad49553aeecda90f9cfbc51a5cbece.tar.bz2
opensim-SC-5de657cf5dad49553aeecda90f9cfbc51a5cbece.tar.xz
Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs10
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs25
2 files changed, 33 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 646a483..b468dde 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -908,6 +908,7 @@ namespace OpenSim.Region.Framework.Scenes
908 if (PhysicsActor != null) 908 if (PhysicsActor != null)
909 { 909 {
910 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 910 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
911 m_physicsActor.OnOutOfBounds -= OutOfBoundsCall;
911 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 912 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
912 m_physicsActor.UnSubscribeEvents(); 913 m_physicsActor.UnSubscribeEvents();
913 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 914 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
@@ -3410,11 +3411,20 @@ namespace OpenSim.Region.Framework.Scenes
3410 scene.AddPhysicsActorTaint(m_physicsActor); 3411 scene.AddPhysicsActorTaint(m_physicsActor);
3411 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3412 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3412 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3413 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3414 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3413 m_physicsActor.SubscribeEvents(500); 3415 m_physicsActor.SubscribeEvents(500);
3414 m_physicsActor.LocalID = LocalId; 3416 m_physicsActor.LocalID = LocalId;
3415 3417
3416 } 3418 }
3417 3419
3420 private void OutOfBoundsCall(PhysicsVector pos)
3421 {
3422 bool flying = m_physicsActor.Flying;
3423 RemoveFromPhysicalScene();
3424
3425 AddToPhysicalScene(flying);
3426 }
3427
3418 // Event called by the physics plugin to tell the avatar about a collision. 3428 // Event called by the physics plugin to tell the avatar about a collision.
3419 private void PhysicsCollisionUpdate(EventArgs e) 3429 private void PhysicsCollisionUpdate(EventArgs e)
3420 { 3430 {
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index bd81d50..e5458d4 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1105,7 +1105,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1105 public void UpdatePositionAndVelocity() 1105 public void UpdatePositionAndVelocity()
1106 { 1106 {
1107 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 1107 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
1108 d.Vector3 vec = d.BodyGetPosition(Body); 1108 d.Vector3 vec;
1109 try
1110 {
1111 vec = d.BodyGetPosition(Body);
1112
1113 }
1114 catch (NullReferenceException)
1115 {
1116 vec = new d.Vector3(_position.X, _position.Y, _position.Z);
1117 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
1118 m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar: {0}", m_name);
1119 }
1120
1109 1121
1110 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1122 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1111 if (vec.X < 0.0f) vec.X = 0.0f; 1123 if (vec.X < 0.0f) vec.X = 0.0f;
@@ -1137,7 +1149,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1137 else 1149 else
1138 { 1150 {
1139 m_lastUpdateSent = false; 1151 m_lastUpdateSent = false;
1140 vec = d.BodyGetLinearVel(Body); 1152 try
1153 {
1154 vec = d.BodyGetLinearVel(Body);
1155 }
1156 catch (NullReferenceException)
1157 {
1158 vec.X = _velocity.X;
1159 vec.Y = _velocity.Y;
1160 vec.Z = _velocity.Z;
1161 }
1141 _velocity.X = (vec.X); 1162 _velocity.X = (vec.X);
1142 _velocity.Y = (vec.Y); 1163 _velocity.Y = (vec.Y);
1143 1164