aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs52
1 files changed, 30 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e5ddeb5..cda90d6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -939,11 +939,14 @@ namespace OpenSim.Region.Framework.Scenes
939 { 939 {
940 if (PhysicsActor != null) 940 if (PhysicsActor != null)
941 { 941 {
942 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 942 lock (m_scene.SyncRoot)
943 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 943 {
944 m_physicsActor.UnSubscribeEvents(); 944 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
945 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 945 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
946 PhysicsActor = null; 946 m_physicsActor.UnSubscribeEvents();
947 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
948 PhysicsActor = null;
949 }
947 } 950 }
948 } 951 }
949 952
@@ -3192,25 +3195,30 @@ namespace OpenSim.Region.Framework.Scenes
3192 /// </summary> 3195 /// </summary>
3193 public void AddToPhysicalScene(bool isFlying) 3196 public void AddToPhysicalScene(bool isFlying)
3194 { 3197 {
3195 PhysicsScene scene = m_scene.PhysicsScene; 3198 lock (m_scene.SyncRoot)
3196
3197 PhysicsVector pVec =
3198 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
3199 AbsolutePosition.Z);
3200
3201 if (m_avHeight == 127.0f)
3202 {
3203 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), isFlying);
3204 }
3205 else
3206 { 3199 {
3207 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight), isFlying); 3200 PhysicsScene scene = m_scene.PhysicsScene;
3201
3202 PhysicsVector pVec =
3203 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
3204 AbsolutePosition.Z);
3205
3206 if (m_avHeight == 127.0f)
3207 {
3208 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f),
3209 isFlying);
3210 }
3211 else
3212 {
3213 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3214 new PhysicsVector(0, 0, m_avHeight), isFlying);
3215 }
3216 scene.AddPhysicsActorTaint(m_physicsActor);
3217 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3218 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3219 m_physicsActor.SubscribeEvents(1000);
3220 m_physicsActor.LocalID = LocalId;
3208 } 3221 }
3209 scene.AddPhysicsActorTaint(m_physicsActor);
3210 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3211 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3212 m_physicsActor.SubscribeEvents(1000);
3213 m_physicsActor.LocalID = LocalId;
3214 } 3222 }
3215 3223
3216 // Event called by the physics plugin to tell the avatar about a collision. 3224 // Event called by the physics plugin to tell the avatar about a collision.