BulletSim: fix avatar bobbing or jiggling while stationary flying.
Various comments and debugging message mods.user_profiles
parent
d92eb80373
commit
1b55a9d81e
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,11 +214,13 @@ 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 (IsColliding)
|
||||
{
|
||||
// If we are colliding with a stationary object, presume we're standing and don't move around
|
||||
if (!ColliderIsMoving)
|
||||
{
|
||||
|
@ -232,7 +234,8 @@ public sealed class BSCharacter : BSPhysObject
|
|||
_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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue