aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2013-08-14 14:13:08 -0700
committerRobert Adams2013-08-14 14:49:22 -0700
commit7c3b71d294987943058c8b3bcb18a424ca70dea5 (patch)
tree1344c3f5c3a1a63a34c07105b6487a608bbd44d6 /OpenSim/Region
parentAdd stat clientstack.<scene>.IncomingPacketsOrphanedCount to record well-form... (diff)
downloadopensim-SC-7c3b71d294987943058c8b3bcb18a424ca70dea5.zip
opensim-SC-7c3b71d294987943058c8b3bcb18a424ca70dea5.tar.gz
opensim-SC-7c3b71d294987943058c8b3bcb18a424ca70dea5.tar.bz2
opensim-SC-7c3b71d294987943058c8b3bcb18a424ca70dea5.tar.xz
BulletSim: add physical object initialized flag so updates and collisions
don't happen until the object is completely initialized. This fixes the problem of doing a teleport while the simulator is running. The destruction of the physical object while the engine is running means that the physics parameter update would overwrite the new position of the newly created avatar.
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs12
5 files changed, 23 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 5f232a4..c0589cd 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
@@ -69,7 +69,9 @@ public class BSActorAvatarMove : BSActor
69 // BSActor.Dispose() 69 // BSActor.Dispose()
70 public override void Dispose() 70 public override void Dispose()
71 { 71 {
72 Enabled = false; 72 base.SetEnabled(false);
73 // Now that turned off, remove any state we have in the scene.
74 Refresh();
73 } 75 }
74 76
75 // Called when physical parameters (properties set in Bullet) need to be re-applied. 77 // Called when physical parameters (properties set in Bullet) need to be re-applied.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 502f85f..291dfcd 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -107,6 +107,8 @@ public sealed class BSCharacter : BSPhysObject
107 PhysicalActors.Add(AvatarMoveActorName, m_moveActor); 107 PhysicalActors.Add(AvatarMoveActorName, m_moveActor);
108 108
109 SetPhysicalProperties(); 109 SetPhysicalProperties();
110
111 IsInitialized = true;
110 }); 112 });
111 return; 113 return;
112 } 114 }
@@ -114,6 +116,8 @@ public sealed class BSCharacter : BSPhysObject
114 // called when this character is being destroyed and the resources should be released 116 // called when this character is being destroyed and the resources should be released
115 public override void Destroy() 117 public override void Destroy()
116 { 118 {
119 IsInitialized = false;
120
117 base.Destroy(); 121 base.Destroy();
118 122
119 DetailLog("{0},BSCharacter.Destroy", LocalID); 123 DetailLog("{0},BSCharacter.Destroy", LocalID);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 27caf62..b26fef0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -72,6 +72,8 @@ public abstract class BSPhysObject : PhysicsActor
72 } 72 }
73 protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName) 73 protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
74 { 74 {
75 IsInitialized = false;
76
75 PhysScene = parentScene; 77 PhysScene = parentScene;
76 LocalID = localID; 78 LocalID = localID;
77 PhysObjectName = name; 79 PhysObjectName = name;
@@ -130,6 +132,8 @@ public abstract class BSPhysObject : PhysicsActor
130 public string PhysObjectName { get; protected set; } 132 public string PhysObjectName { get; protected set; }
131 public string TypeName { get; protected set; } 133 public string TypeName { get; protected set; }
132 134
135 // Set to 'true' when the object is completely initialized
136 public bool IsInitialized { get; protected set; }
133 137
134 // Return the object mass without calculating it or having side effects 138 // Return the object mass without calculating it or having side effects
135 public abstract float RawMass { get; } 139 public abstract float RawMass { get; }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 6b5dea3..d5b999d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -110,6 +110,8 @@ public class BSPrim : BSPhysObject
110 CreateGeomAndObject(true); 110 CreateGeomAndObject(true);
111 111
112 CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody); 112 CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody);
113
114 IsInitialized = true;
113 }); 115 });
114 } 116 }
115 117
@@ -117,6 +119,8 @@ public class BSPrim : BSPhysObject
117 public override void Destroy() 119 public override void Destroy()
118 { 120 {
119 // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); 121 // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
122 IsInitialized = false;
123
120 base.Destroy(); 124 base.Destroy();
121 125
122 // Undo any vehicle properties 126 // Undo any vehicle properties
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 79ac5a5..88d50b4 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -639,7 +639,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
639 BSPhysObject pobj; 639 BSPhysObject pobj;
640 if (PhysObjects.TryGetValue(entprop.ID, out pobj)) 640 if (PhysObjects.TryGetValue(entprop.ID, out pobj))
641 { 641 {
642 pobj.UpdateProperties(entprop); 642 if (pobj.IsInitialized)
643 pobj.UpdateProperties(entprop);
643 } 644 }
644 } 645 }
645 } 646 }
@@ -766,10 +767,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
766 767
767 // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); 768 // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
768 769
769 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) 770 if (collider.IsInitialized)
770 { 771 {
771 // If a collision was 'good', remember to send it to the simulator 772 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
772 ObjectsWithCollisions.Add(collider); 773 {
774 // If a collision was 'good', remember to send it to the simulator
775 ObjectsWithCollisions.Add(collider);
776 }
773 } 777 }
774 778
775 return; 779 return;