diff options
Diffstat (limited to 'OpenSim')
5 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 5f232a4..68bc1b9 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. |
@@ -181,7 +183,7 @@ public class BSActorAvatarMove : BSActor | |||
181 | if (m_controllingPrim.IsColliding) | 183 | if (m_controllingPrim.IsColliding) |
182 | { | 184 | { |
183 | // If we are colliding with a stationary object, presume we're standing and don't move around | 185 | // If we are colliding with a stationary object, presume we're standing and don't move around |
184 | if (!m_controllingPrim.ColliderIsMoving) | 186 | if (!m_controllingPrim.ColliderIsMoving && !m_controllingPrim.ColliderIsVolumeDetect) |
185 | { | 187 | { |
186 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID); | 188 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID); |
187 | m_controllingPrim.IsStationary = true; | 189 | m_controllingPrim.IsStationary = true; |
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..9dc52d5 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,9 @@ 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 | // This mostly prevents property updates and collisions until the object is completely here. | ||
137 | public bool IsInitialized { get; protected set; } | ||
133 | 138 | ||
134 | // Return the object mass without calculating it or having side effects | 139 | // Return the object mass without calculating it or having side effects |
135 | public abstract float RawMass { get; } | 140 | public abstract float RawMass { get; } |
@@ -352,6 +357,8 @@ public abstract class BSPhysObject : PhysicsActor | |||
352 | // On a collision, check the collider and remember if the last collider was moving | 357 | // On a collision, check the collider and remember if the last collider was moving |
353 | // Used to modify the standing of avatars (avatars on stationary things stand still) | 358 | // Used to modify the standing of avatars (avatars on stationary things stand still) |
354 | public bool ColliderIsMoving; | 359 | public bool ColliderIsMoving; |
360 | // 'true' if the last collider was a volume detect object | ||
361 | public bool ColliderIsVolumeDetect; | ||
355 | // Used by BSCharacter to manage standing (and not slipping) | 362 | // Used by BSCharacter to manage standing (and not slipping) |
356 | public bool IsStationary; | 363 | public bool IsStationary; |
357 | 364 | ||
@@ -431,6 +438,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
431 | 438 | ||
432 | // For movement tests, remember if we are colliding with an object that is moving. | 439 | // For movement tests, remember if we are colliding with an object that is moving. |
433 | ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false; | 440 | ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false; |
441 | ColliderIsVolumeDetect = collidee != null ? (collidee.IsVolumeDetect) : false; | ||
434 | 442 | ||
435 | // Make a collection of the collisions that happened the last simulation tick. | 443 | // Make a collection of the collisions that happened the last simulation tick. |
436 | // This is different than the collection created for sending up to the simulator as it is cleared every tick. | 444 | // This is different than the collection created for sending up to the simulator as it is cleared every tick. |
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; |