aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2013-02-08 15:25:57 -0800
committerRobert Adams2013-02-08 16:29:40 -0800
commit1b55a9d81e66972312fdc801d17da697466f9ed4 (patch)
tree32c478526da580deb85a5a1218434e8e21173cd1 /OpenSim
parentBulletSim: add initial instance of the ExtendedPhysics region module which ad... (diff)
downloadopensim-SC_OLD-1b55a9d81e66972312fdc801d17da697466f9ed4.zip
opensim-SC_OLD-1b55a9d81e66972312fdc801d17da697466f9ed4.tar.gz
opensim-SC_OLD-1b55a9d81e66972312fdc801d17da697466f9ed4.tar.bz2
opensim-SC_OLD-1b55a9d81e66972312fdc801d17da697466f9ed4.tar.xz
BulletSim: fix avatar bobbing or jiggling while stationary flying.
Various comments and debugging message mods.
Diffstat (limited to 'OpenSim')
-rwxr-xr-xOpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs10
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs29
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs2
6 files changed, 34 insertions, 19 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
index aaa349f..6009dc5 100755
--- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
@@ -77,13 +77,14 @@ public class ExtendedPhysics : INonSharedRegionModule
77 m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e); 77 m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e);
78 } 78 }
79 79
80 m_log.ErrorFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not")); 80 m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not"));
81 } 81 }
82 82
83 public void Close() 83 public void Close()
84 { 84 {
85 if (BaseScene != null) 85 if (BaseScene != null)
86 { 86 {
87 BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
87 BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated; 88 BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated;
88 BaseScene = null; 89 BaseScene = null;
89 } 90 }
@@ -120,13 +121,20 @@ public class ExtendedPhysics : INonSharedRegionModule
120 Comms.RegisterScriptInvocations(this); 121 Comms.RegisterScriptInvocations(this);
121 122
122 // When an object is modified, we might need to update its extended physics parameters 123 // When an object is modified, we might need to update its extended physics parameters
124 BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
123 BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated; 125 BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated;
126
124 } 127 }
125 128
126 public Type ReplaceableInterface { get { return null; } } 129 public Type ReplaceableInterface { get { return null; } }
127 130
128 #endregion // INonSharedRegionModule 131 #endregion // INonSharedRegionModule
129 132
133 private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
134 {
135 throw new NotImplementedException();
136 }
137
130 // Event generated when some property of a prim changes. 138 // Event generated when some property of a prim changes.
131 private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate) 139 private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate)
132 { 140 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 0afc437..6a995a2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -140,7 +140,7 @@ public sealed class BSCharacter : BSPhysObject
140 ZeroMotion(true); 140 ZeroMotion(true);
141 ForcePosition = _position; 141 ForcePosition = _position;
142 142
143 // Set the velocity and compute the proper friction 143 // Set the velocity
144 _velocityMotor.Reset(); 144 _velocityMotor.Reset();
145 _velocityMotor.SetTarget(_velocity); 145 _velocityMotor.SetTarget(_velocity);
146 _velocityMotor.SetCurrent(_velocity); 146 _velocityMotor.SetCurrent(_velocity);
@@ -214,25 +214,28 @@ public sealed class BSCharacter : BSPhysObject
214 _velocityMotor.Step(timeStep); 214 _velocityMotor.Step(timeStep);
215 215
216 // If we're not supposed to be moving, make sure things are zero. 216 // If we're not supposed to be moving, make sure things are zero.
217 if (_velocityMotor.ErrorIsZero() && _velocityMotor.TargetValue == OMV.Vector3.Zero && IsColliding) 217 if (_velocityMotor.ErrorIsZero() && _velocityMotor.TargetValue == OMV.Vector3.Zero)
218 { 218 {
219 // The avatar shouldn't be moving 219 // The avatar shouldn't be moving
220 _velocityMotor.Zero(); 220 _velocityMotor.Zero();
221 221
222 // If we are colliding with a stationary object, presume we're standing and don't move around 222 if (IsColliding)
223 if (!ColliderIsMoving)
224 { 223 {
225 DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID); 224 // If we are colliding with a stationary object, presume we're standing and don't move around
226 ZeroMotion(true /* inTaintTime */); 225 if (!ColliderIsMoving)
227 } 226 {
227 DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID);
228 ZeroMotion(true /* inTaintTime */);
229 }
228 230
229 // Standing has more friction on the ground 231 // Standing has more friction on the ground
230 if (_currentFriction != BSParam.AvatarStandingFriction) 232 if (_currentFriction != BSParam.AvatarStandingFriction)
231 { 233 {
232 _currentFriction = BSParam.AvatarStandingFriction; 234 _currentFriction = BSParam.AvatarStandingFriction;
233 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction); 235 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction);
236 }
234 } 237 }
235 DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1}", LocalID, _velocityMotor.TargetValue); 238 DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}", LocalID, _velocityMotor.TargetValue, IsColliding);
236 } 239 }
237 else 240 else
238 { 241 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 8e69db3..e35311f 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -71,6 +71,10 @@ public abstract class BSLinkset
71 ret = new BSLinksetCompound(physScene, parent); 71 ret = new BSLinksetCompound(physScene, parent);
72 break; 72 break;
73 } 73 }
74 if (ret == null)
75 {
76 physScene.Logger.ErrorFormat("[BULLETSIM LINKSET] Factory could not create linkset. Parent name={1}, ID={2}", parent.Name, parent.LocalID);
77 }
74 return ret; 78 return ret;
75 } 79 }
76 80
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index e1d269a..de69fa0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -290,13 +290,13 @@ public abstract class BSPhysObject : PhysicsActor
290 CollisionAccumulation++; 290 CollisionAccumulation++;
291 291
292 // For movement tests, remember if we are colliding with an object that is moving. 292 // For movement tests, remember if we are colliding with an object that is moving.
293 ColliderIsMoving = collidee != null ? collidee.RawVelocity != OMV.Vector3.Zero : false; 293 ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false;
294 294
295 // If someone has subscribed for collision events log the collision so it will be reported up 295 // If someone has subscribed for collision events log the collision so it will be reported up
296 if (SubscribedEvents()) { 296 if (SubscribedEvents()) {
297 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 297 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
298 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}", 298 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
299 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth); 299 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
300 300
301 ret = true; 301 ret = true;
302 } 302 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
index fd66d1c..9898562 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
@@ -160,8 +160,8 @@ public class BSPrimLinkable : BSPrimDisplaced
160 // TODO: this will have to change when linksets are articulated. 160 // TODO: this will have to change when linksets are articulated.
161 base.UpdateProperties(entprop); 161 base.UpdateProperties(entprop);
162 } 162 }
163 // The linkset might like to know about changing locations
163 Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); 164 Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this);
164
165 } 165 }
166 166
167 public override bool Collide(uint collidingWith, BSPhysObject collidee, 167 public override bool Collide(uint collidingWith, BSPhysObject collidee,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index e506d22..05722b8 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -463,7 +463,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
463 463
464 if (!m_initialized) return null; 464 if (!m_initialized) return null;
465 465
466 DetailLog("{0},AddPrimShape,call", localID); 466 DetailLog("{0},BSScene.AddPrimShape,call", localID);
467 467
468 BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical); 468 BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical);
469 lock (PhysObjects) PhysObjects.Add(localID, prim); 469 lock (PhysObjects) PhysObjects.Add(localID, prim);