diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index aaa349f930..6009dc57a8 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 m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e); } - m_log.ErrorFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not")); + m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not")); } public void Close() { if (BaseScene != null) { + BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated; BaseScene = null; } @@ -120,13 +121,20 @@ public class ExtendedPhysics : INonSharedRegionModule Comms.RegisterScriptInvocations(this); // When an object is modified, we might need to update its extended physics parameters + BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated; + } public Type ReplaceableInterface { get { return null; } } #endregion // INonSharedRegionModule + private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) + { + throw new NotImplementedException(); + } + // Event generated when some property of a prim changes. private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate) { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 0afc4372d6..6a995a2e1e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -140,7 +140,7 @@ public sealed class BSCharacter : BSPhysObject ZeroMotion(true); ForcePosition = _position; - // Set the velocity and compute the proper friction + // Set the velocity _velocityMotor.Reset(); _velocityMotor.SetTarget(_velocity); _velocityMotor.SetCurrent(_velocity); @@ -214,25 +214,28 @@ public sealed class BSCharacter : BSPhysObject _velocityMotor.Step(timeStep); // If we're not supposed to be moving, make sure things are zero. - if (_velocityMotor.ErrorIsZero() && _velocityMotor.TargetValue == OMV.Vector3.Zero && IsColliding) + if (_velocityMotor.ErrorIsZero() && _velocityMotor.TargetValue == OMV.Vector3.Zero) { // The avatar shouldn't be moving _velocityMotor.Zero(); - // If we are colliding with a stationary object, presume we're standing and don't move around - if (!ColliderIsMoving) + if (IsColliding) { - DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID); - ZeroMotion(true /* inTaintTime */); - } + // If we are colliding with a stationary object, presume we're standing and don't move around + if (!ColliderIsMoving) + { + DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID); + ZeroMotion(true /* inTaintTime */); + } - // Standing has more friction on the ground - if (_currentFriction != BSParam.AvatarStandingFriction) - { - _currentFriction = BSParam.AvatarStandingFriction; - PhysicsScene.PE.SetFriction(PhysBody, _currentFriction); + // Standing has more friction on the ground + if (_currentFriction != BSParam.AvatarStandingFriction) + { + _currentFriction = BSParam.AvatarStandingFriction; + PhysicsScene.PE.SetFriction(PhysBody, _currentFriction); + } } - DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1}", LocalID, _velocityMotor.TargetValue); + DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}", LocalID, _velocityMotor.TargetValue, IsColliding); } else { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 8e69db3288..e35311ff11 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs @@ -71,6 +71,10 @@ public abstract class BSLinkset ret = new BSLinksetCompound(physScene, parent); break; } + if (ret == null) + { + physScene.Logger.ErrorFormat("[BULLETSIM LINKSET] Factory could not create linkset. Parent name={1}, ID={2}", parent.Name, parent.LocalID); + } return ret; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index e1d269ac96..de69fa0699 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -290,13 +290,13 @@ public abstract class BSPhysObject : PhysicsActor CollisionAccumulation++; // For movement tests, remember if we are colliding with an object that is moving. - ColliderIsMoving = collidee != null ? collidee.RawVelocity != OMV.Vector3.Zero : false; + ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false; // If someone has subscribed for collision events log the collision so it will be reported up if (SubscribedEvents()) { CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); - DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}", - LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth); + DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}", + LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving); ret = true; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index fd66d1cf24..989856201e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs @@ -160,8 +160,8 @@ public class BSPrimLinkable : BSPrimDisplaced // TODO: this will have to change when linksets are articulated. base.UpdateProperties(entprop); } + // The linkset might like to know about changing locations Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); - } 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 e506d22438..05722b8c34 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 if (!m_initialized) return null; - DetailLog("{0},AddPrimShape,call", localID); + DetailLog("{0},BSScene.AddPrimShape,call", localID); BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical); lock (PhysObjects) PhysObjects.Add(localID, prim);