diff options
author | Robert Adams | 2013-01-20 22:35:42 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-20 23:09:54 -0800 |
commit | 52b341e2e24384395fddc7d32fd66358f5062468 (patch) | |
tree | a0b28ec5b79004b1a556db78d835e486b8040632 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | BulletSim: fix problem of avatar sliding very slowly occasionally after stopp... (diff) | |
download | opensim-SC_OLD-52b341e2e24384395fddc7d32fd66358f5062468.zip opensim-SC_OLD-52b341e2e24384395fddc7d32fd66358f5062468.tar.gz opensim-SC_OLD-52b341e2e24384395fddc7d32fd66358f5062468.tar.bz2 opensim-SC_OLD-52b341e2e24384395fddc7d32fd66358f5062468.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 13 |
1 files changed, 9 insertions, 4 deletions
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 | |||
989 | } | 989 | } |
990 | set { | 990 | set { |
991 | _rotationalVelocity = value; | 991 | _rotationalVelocity = value; |
992 | Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); | ||
992 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); | 993 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); |
993 | PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() | 994 | PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() |
994 | { | 995 | { |
995 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | ||
996 | ForceRotationalVelocity = _rotationalVelocity; | 996 | ForceRotationalVelocity = _rotationalVelocity; |
997 | }); | 997 | }); |
998 | } | 998 | } |
@@ -1005,6 +1005,7 @@ public sealed class BSPrim : BSPhysObject | |||
1005 | _rotationalVelocity = value; | 1005 | _rotationalVelocity = value; |
1006 | if (PhysBody.HasPhysicalBody) | 1006 | if (PhysBody.HasPhysicalBody) |
1007 | { | 1007 | { |
1008 | DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | ||
1008 | PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); | 1009 | PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); |
1009 | ActivateIfPhysical(false); | 1010 | ActivateIfPhysical(false); |
1010 | } | 1011 | } |
@@ -1193,10 +1194,14 @@ public sealed class BSPrim : BSPhysObject | |||
1193 | public override float APIDDamping { set { return; } } | 1194 | public override float APIDDamping { set { return; } } |
1194 | 1195 | ||
1195 | public override void AddForce(OMV.Vector3 force, bool pushforce) { | 1196 | public override void AddForce(OMV.Vector3 force, bool pushforce) { |
1197 | // Per documentation, max force is limited. | ||
1198 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); | ||
1199 | |||
1196 | // Since this force is being applied in only one step, make this a force per second. | 1200 | // Since this force is being applied in only one step, make this a force per second. |
1197 | OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep; | 1201 | addForce /= PhysicsScene.LastTimeStep; |
1198 | AddForce(addForce, pushforce, false); | 1202 | AddForce(addForce, pushforce, false /* inTaintTime */); |
1199 | } | 1203 | } |
1204 | |||
1200 | // Applying a force just adds this to the total force on the object. | 1205 | // Applying a force just adds this to the total force on the object. |
1201 | // This added force will only last the next simulation tick. | 1206 | // This added force will only last the next simulation tick. |
1202 | public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { | 1207 | public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { |
@@ -1205,9 +1210,9 @@ public sealed class BSPrim : BSPhysObject | |||
1205 | { | 1210 | { |
1206 | if (force.IsFinite()) | 1211 | if (force.IsFinite()) |
1207 | { | 1212 | { |
1208 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); | ||
1209 | // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); | 1213 | // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); |
1210 | 1214 | ||
1215 | OMV.Vector3 addForce = force; | ||
1211 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() | 1216 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() |
1212 | { | 1217 | { |
1213 | // Bullet adds this central force to the total force for this tick | 1218 | // Bullet adds this central force to the total force for this tick |