From 75f710f1e70a3c9d3459d549eb4334a445aca834 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 17 Jan 2013 14:47:35 -0800 Subject: BulletSim: Add one function that all actors who act on the physical can use to know if the object is currently active. Code cleaning including use of Util.ClampV function. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 33 ++++++++++---------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 79fe632..7aa2d92 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -132,8 +132,8 @@ public sealed class BSPrim : BSPhysObject base.Destroy(); // Undo any links between me and any other object - BSPhysObject parentBefore = Linkset.LinksetRoot; - int childrenBefore = Linkset.NumberOfChildren; + BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG DEBUG + int childrenBefore = Linkset.NumberOfChildren; // DEBUG DEBUG Linkset = Linkset.RemoveMeFromLinkset(this); @@ -727,6 +727,12 @@ public sealed class BSPrim : BSPhysObject get { return !IsPhantom && !_isVolumeDetect; } } + // The object is moving and is actively being dynamic in the physical world + public override bool IsPhysicallyActive + { + get { return !_isSelected && IsPhysical; } + } + // Make gravity work if the object is physical and not selected // Called at taint-time!! private void SetObjectDynamic(bool forceRebuild) @@ -1174,18 +1180,11 @@ public sealed class BSPrim : BSPhysObject // This added force will only last the next simulation tick. public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { // for an object, doesn't matter if force is a pushforce or not - if (!IsStatic) + if (IsPhysicallyActive) { if (force.IsFinite()) { - float magnitude = force.Length(); - if (magnitude > BSParam.MaxAddForceMagnitude) - { - // Force has a limit - force = force / magnitude * BSParam.MaxAddForceMagnitude; - } - - OMV.Vector3 addForce = force; + OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() @@ -1209,19 +1208,13 @@ public sealed class BSPrim : BSPhysObject public void AddForceImpulse(OMV.Vector3 impulse, bool pushforce, bool inTaintTime) { // for an object, doesn't matter if force is a pushforce or not - if (!IsStatic) + if (!IsPhysicallyActive) { if (impulse.IsFinite()) { - float magnitude = impulse.Length(); - if (magnitude > BSParam.MaxAddForceMagnitude) - { - // Force has a limit - impulse = impulse / magnitude * BSParam.MaxAddForceMagnitude; - } - + OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude); // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse); - OMV.Vector3 addImpulse = impulse; + PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate() { // Bullet adds this impulse immediately to the velocity -- cgit v1.1 From 482c7b5368faa034b73b3434fd90ce3702644cb8 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 18 Jan 2013 11:37:36 -0800 Subject: BulletSim: add logic to turn off pre-step actions when object goes non-active. This turns off 'setForce', 'setTorque' and 'moveToTarget' when the object is selected or made non-physical. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 7aa2d92..aaa6fe5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -502,6 +502,12 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.setForce", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + { + UnRegisterPreStepAction("BSPrim.setForce", LocalID); + return; + } + DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); if (PhysBody.HasPhysicalBody) { @@ -627,6 +633,12 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.setTorque", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + { + UnRegisterPreStepAction("BSPrim.setTorque", LocalID); + return; + } + if (PhysBody.HasPhysicalBody) AddAngularForce(_torque, false, true); } @@ -1061,6 +1073,12 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + { + UnRegisterPreStepAction("BSPrim.PIDTarget", LocalID); + return; + } + OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) // 'movePosition' is where we'd like the prim to be at this moment. @@ -1108,6 +1126,9 @@ public sealed class BSPrim : BSPhysObject RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep) { + if (!IsPhysicallyActive) + return; + _hoverMotor.SetCurrent(RawPosition.Z); _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight()); float targetHeight = _hoverMotor.Step(timeStep); -- cgit v1.1 From 3b0df52d10c157cd2711d64ef9007d2afccbd468 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 20 Jan 2013 09:33:13 -0800 Subject: BulletSim: modify motors to return correction rather than current value to better use them for incremental updates. Modify prim and character to use the new motors. Simplify the vehicle linear movement code to just update the velocity directly or the basic movement. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index aaa6fe5..22afdc9 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1082,7 +1082,7 @@ public sealed class BSPrim : BSPhysObject OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) // 'movePosition' is where we'd like the prim to be at this moment. - OMV.Vector3 movePosition = _targetMotor.Step(timeStep); + OMV.Vector3 movePosition = RawPosition + _targetMotor.Step(timeStep); // If we are very close to our target, turn off the movement motor. if (_targetMotor.ErrorIsZero()) -- cgit v1.1 From 52b341e2e24384395fddc7d32fd66358f5062468 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 20 Jan 2013 22:35:42 -0800 Subject: BulletSim: More aggressive as setting character velocity to zero when should be standing. Modify angular force routines to be the same pattern as linear force routines. BulletSim vehicle turning is scaled like SL and is DIFFERENT THAN ODE!! Fix some bugs in BSMotor dealing with the motor going to zero. Add a bunch of parameters: MaxLinearVelocity, MaxAngularVelocity, MaxAddForceMagnitude, VehicleMaxLinearVelocity, VehicleMaxAngularVelocity, and most of the values are defaulted to values that are larger than in SL. Use the new parameters in BSPrim, BSCharacter and BSDynamic. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 22afdc9..b63523c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -989,10 +989,10 @@ public sealed class BSPrim : BSPhysObject } set { _rotationalVelocity = value; + Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() { - DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); ForceRotationalVelocity = _rotationalVelocity; }); } @@ -1005,6 +1005,7 @@ public sealed class BSPrim : BSPhysObject _rotationalVelocity = value; if (PhysBody.HasPhysicalBody) { + DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); ActivateIfPhysical(false); } @@ -1193,10 +1194,14 @@ public sealed class BSPrim : BSPhysObject public override float APIDDamping { set { return; } } public override void AddForce(OMV.Vector3 force, bool pushforce) { + // Per documentation, max force is limited. + OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); + // Since this force is being applied in only one step, make this a force per second. - OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep; - AddForce(addForce, pushforce, false); + addForce /= PhysicsScene.LastTimeStep; + AddForce(addForce, pushforce, false /* inTaintTime */); } + // Applying a force just adds this to the total force on the object. // This added force will only last the next simulation tick. public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { @@ -1205,9 +1210,9 @@ public sealed class BSPrim : BSPhysObject { if (force.IsFinite()) { - OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); + OMV.Vector3 addForce = force; PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() { // Bullet adds this central force to the total force for this tick -- cgit v1.1 From 471c4778639aec60078e6cee7c964682c959f033 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 21 Jan 2013 15:58:22 -0800 Subject: BulletSim: allow changing position and rotation of a child of a linkset without rebuilding the whole compound shape. Should make vehicles move smoother. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index b63523c..468ff40 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -311,13 +311,14 @@ public sealed class BSPrim : BSPhysObject _position = value; PositionSanityCheck(false); - // A linkset might need to know if a component information changed. - Linkset.UpdateProperties(this, false); - PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() { DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); ForcePosition = _position; + + // A linkset might need to know if a component information changed. + Linkset.UpdateProperties(UpdatedProperties.Position, this); + }); } } @@ -682,12 +683,13 @@ public sealed class BSPrim : BSPhysObject return; _orientation = value; - // A linkset might need to know if a component information changed. - Linkset.UpdateProperties(this, false); - PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() { ForceOrientation = _orientation; + + // A linkset might need to know if a component information changed. + Linkset.UpdateProperties(UpdatedProperties.Orientation, this); + }); } } @@ -1686,7 +1688,7 @@ public sealed class BSPrim : BSPhysObject */ // The linkset implimentation might want to know about this. - Linkset.UpdateProperties(this, true); + Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); } } } -- cgit v1.1 From 80b1e32bfa00a2d3354f0d7e0df83a5b0b3e2c49 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 21 Jan 2013 23:43:24 -0800 Subject: BulletSim: Tweeks to vehicle motion. Pass through old angular velocity making for smoother transitions. Remove some old kludges for angular motion (damping and rotvel suppression). --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 468ff40..e6b8507 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1009,6 +1009,7 @@ public sealed class BSPrim : BSPhysObject { DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); + // PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); ActivateIfPhysical(false); } } @@ -1649,7 +1650,7 @@ public sealed class BSPrim : BSPhysObject // TODO: handle physics introduced by Bullet with computed vehicle physics. if (_vehicle.IsActive) { - entprop.RotationalVelocity = OMV.Vector3.Zero; + // entprop.RotationalVelocity = OMV.Vector3.Zero; } // Assign directly to the local variables so the normal set actions do not happen -- cgit v1.1 From a0d460e6bfa64a6c43ff327dcf19b696cc380fbb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 18 Jan 2013 12:10:03 -0800 Subject: BulletSim: remove the unused RestoreBodyDependencies used by linksets and vehicles and clean up code by removing their kludgyness. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index e6b8507..b37a1f8 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1606,11 +1606,6 @@ public sealed class BSPrim : BSPhysObject // Called at taint-time!!! public void CreateGeomAndObject(bool forceRebuild) { - // If this prim is part of a linkset, we must remove and restore the physical - // links if the body is rebuilt. - bool needToRestoreLinkset = false; - bool needToRestoreVehicle = false; - // Create the correct physical representation for this type of object. // Updates PhysBody and PhysShape with the new information. // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. @@ -1619,21 +1614,10 @@ public sealed class BSPrim : BSPhysObject // Called if the current prim body is about to be destroyed. // Remove all the physical dependencies on the old body. // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...) - needToRestoreLinkset = Linkset.RemoveBodyDependencies(this); - needToRestoreVehicle = _vehicle.RemoveBodyDependencies(this); + Linkset.RemoveBodyDependencies(this); + _vehicle.RemoveBodyDependencies(this); }); - if (needToRestoreLinkset) - { - // If physical body dependencies were removed, restore them - Linkset.RestoreBodyDependencies(this); - } - if (needToRestoreVehicle) - { - // If physical body dependencies were removed, restore them - _vehicle.RestoreBodyDependencies(this); - } - // Make sure the properties are set on the new object UpdatePhysicalParameters(); return; -- cgit v1.1 From c1371ab786a699ce91693e6e575bb81144a79c57 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 23 Jan 2013 08:28:36 -0800 Subject: BulletSim: working on COM --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index b37a1f8..dad7250 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -336,6 +336,7 @@ public sealed class BSPrim : BSPhysObject } } } + /* Disable. Presume whoever is setting displacement is already adjusting position, etc. // Override to have position displacement immediately update the physical position. // A feeble attempt to keep the sim and physical positions in sync // Must be called at taint time. @@ -355,6 +356,7 @@ public sealed class BSPrim : BSPhysObject }); } } + */ // Check that the current position is sane and, if not, modify the position to make it so. // Check for being below terrain and being out of bounds. @@ -371,11 +373,11 @@ public sealed class BSPrim : BSPhysObject return ret; } - float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); + float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition); OMV.Vector3 upForce = OMV.Vector3.Zero; if (RawPosition.Z < terrainHeight) { - DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, _position, terrainHeight); + DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, RawPosition, terrainHeight); float targetHeight = terrainHeight + (Size.Z / 2f); // If the object is below ground it just has to be moved up because pushing will // not get it through the terrain @@ -1637,7 +1639,11 @@ public sealed class BSPrim : BSPhysObject // entprop.RotationalVelocity = OMV.Vector3.Zero; } + DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG + // Assign directly to the local variables so the normal set actions do not happen + + // Undo any center-of-mass displacement that might have been done. entprop.Position -= PositionDisplacement; _position = entprop.Position; _orientation = entprop.Rotation; @@ -1645,6 +1651,8 @@ public sealed class BSPrim : BSPhysObject _acceleration = entprop.Acceleration; _rotationalVelocity = entprop.RotationalVelocity; + DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG + // The sanity check can change the velocity and/or position. if (IsPhysical && PositionSanityCheck(true)) { @@ -1653,8 +1661,7 @@ public sealed class BSPrim : BSPhysObject } OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG - DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", - LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity); + DetailLog("{0},BSPrim.UpdateProperties,call,entProp={1},dir={2}", LocalID, entprop, direction); // remember the current and last set values LastEntityProperties = CurrentEntityProperties; -- cgit v1.1 From a5e9c665f08059fef16d0b0875697cb08e16351e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 23 Jan 2013 09:09:17 -0800 Subject: BulletSim: center-of-gravity linkset changes. Not working yet. Conflicts: OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index dad7250..ee2bfa0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -322,6 +322,7 @@ public sealed class BSPrim : BSPhysObject }); } } + public override OMV.Vector3 ForcePosition { get { _position = PhysicsScene.PE.GetPosition(PhysBody) - PositionDisplacement; @@ -336,27 +337,6 @@ public sealed class BSPrim : BSPhysObject } } } - /* Disable. Presume whoever is setting displacement is already adjusting position, etc. - // Override to have position displacement immediately update the physical position. - // A feeble attempt to keep the sim and physical positions in sync - // Must be called at taint time. - public override OMV.Vector3 PositionDisplacement - { - get - { - return base.PositionDisplacement; - } - set - { - base.PositionDisplacement = value; - PhysicsScene.TaintedObject(PhysicsScene.InTaintTime, "BSPrim.setPosition", delegate() - { - if (PhysBody.HasPhysicalBody) - PhysicsScene.PE.SetTranslation(PhysBody, _position + base.PositionDisplacement, _orientation); - }); - } - } - */ // Check that the current position is sane and, if not, modify the position to make it so. // Check for being below terrain and being out of bounds. -- cgit v1.1 From 13182904da897be1dad0bb86d8099bd0956ffac4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 23 Jan 2013 09:11:01 -0800 Subject: BulletSim: small change to center-of-mass computation left out last commit --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index ee2bfa0..731ab7b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1621,10 +1621,15 @@ public sealed class BSPrim : BSPhysObject DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG - // Assign directly to the local variables so the normal set actions do not happen - // Undo any center-of-mass displacement that might have been done. - entprop.Position -= PositionDisplacement; + if (PositionDisplacement != OMV.Vector3.Zero) + { + // Correct for any rotation around the center-of-mass + // TODO!!! + entprop.Position -= PositionDisplacement; + } + + // Assign directly to the local variables so the normal set actions do not happen _position = entprop.Position; _orientation = entprop.Rotation; _velocity = entprop.Velocity; -- cgit v1.1 From a7b810ddeebda8b13af3ab9fbeb24bef1a8094c6 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 23 Jan 2013 14:21:52 -0800 Subject: BulletSim: remove setting of vehicle InterpolationRotationalVelocity. This doesn't seem to help the vehicle stability. Rename vehicle internal variables adding a "V" or "W" so it is clear when coordinates are vehicle or world relative. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 731ab7b..f80084a 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1619,7 +1619,7 @@ public sealed class BSPrim : BSPhysObject // entprop.RotationalVelocity = OMV.Vector3.Zero; } - DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG + // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG // Undo any center-of-mass displacement that might have been done. if (PositionDisplacement != OMV.Vector3.Zero) @@ -1636,7 +1636,7 @@ public sealed class BSPrim : BSPhysObject _acceleration = entprop.Acceleration; _rotationalVelocity = entprop.RotationalVelocity; - DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG + // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG // The sanity check can change the velocity and/or position. if (IsPhysical && PositionSanityCheck(true)) -- cgit v1.1