diff options
author | Robert Adams | 2013-01-25 16:52:16 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-27 12:50:05 -0800 |
commit | 36f401d85011b0ffb548e79923381be894dbfabb (patch) | |
tree | a40639407a7c8b8d258997b8f55838a3f9f754c3 /OpenSim/Region/Physics | |
parent | BulletSim: first attempt at reporting top colliders (diff) | |
download | opensim-SC_OLD-36f401d85011b0ffb548e79923381be894dbfabb.zip opensim-SC_OLD-36f401d85011b0ffb548e79923381be894dbfabb.tar.gz opensim-SC_OLD-36f401d85011b0ffb548e79923381be894dbfabb.tar.bz2 opensim-SC_OLD-36f401d85011b0ffb548e79923381be894dbfabb.tar.xz |
BulletSim: parameterize the value for gravity reduction for ground vehicles on the ground. Set defaults for vehicle factors to one. Debug logging changes.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 15 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 2 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 12 |
3 files changed, 18 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 06b4620..90482fd 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -976,8 +976,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
976 | public void ComputeLinearVelocity(float pTimestep) | 976 | public void ComputeLinearVelocity(float pTimestep) |
977 | { | 977 | { |
978 | // Step the motor from the current value. Get the correction needed this step. | 978 | // Step the motor from the current value. Get the correction needed this step. |
979 | Vector3 currentVel = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); | 979 | Vector3 origVelW = VehicleVelocity; // DEBUG |
980 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVel); | 980 | Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); |
981 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV); | ||
981 | 982 | ||
982 | // Motor is vehicle coordinates. Rotate it to world coordinates | 983 | // Motor is vehicle coordinates. Rotate it to world coordinates |
983 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; | 984 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; |
@@ -992,8 +993,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
992 | // Add this correction to the velocity to make it faster/slower. | 993 | // Add this correction to the velocity to make it faster/slower. |
993 | VehicleVelocity += linearMotorVelocityW; | 994 | VehicleVelocity += linearMotorVelocityW; |
994 | 995 | ||
995 | VDetailLog("{0}, MoveLinear,velocity,vehVel={1},correction={2},force={3}", | 996 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5}", |
996 | Prim.LocalID, VehicleVelocity, linearMotorCorrectionV, linearMotorVelocityW); | 997 | Prim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, linearMotorVelocityW, VehicleVelocity); |
997 | } | 998 | } |
998 | 999 | ||
999 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) | 1000 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) |
@@ -1193,12 +1194,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1193 | 1194 | ||
1194 | // Hack to reduce downward force if the vehicle is probably sitting on the ground | 1195 | // Hack to reduce downward force if the vehicle is probably sitting on the ground |
1195 | if (Prim.IsColliding && IsGroundVehicle) | 1196 | if (Prim.IsColliding && IsGroundVehicle) |
1196 | appliedGravity *= 0.2f; | 1197 | appliedGravity *= BSParam.VehicleGroundGravityFudge; |
1197 | 1198 | ||
1198 | VehicleAddForce(appliedGravity); | 1199 | VehicleAddForce(appliedGravity); |
1199 | 1200 | ||
1200 | VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},appliedForce-{2}", | 1201 | VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},appliedForce={3}", |
1201 | Prim.LocalID, m_VehicleGravity, appliedGravity); | 1202 | Prim.LocalID, m_VehicleGravity, Prim.IsColliding, appliedGravity); |
1202 | } | 1203 | } |
1203 | 1204 | ||
1204 | // ======================================================================= | 1205 | // ======================================================================= |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 2c8dd23..6c53c50 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -232,7 +232,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
232 | newLsi.OffsetFromCenterOfMass, | 232 | newLsi.OffsetFromCenterOfMass, |
233 | newLsi.OffsetRot, | 233 | newLsi.OffsetRot, |
234 | true /* shouldRecalculateLocalAabb */); | 234 | true /* shouldRecalculateLocalAabb */); |
235 | DetailLog("{0},BSLinksetCompound.UpdateProperties,changeChildPosRot,whichUpdated={1}newLsi={2}", | 235 | DetailLog("{0},BSLinksetCompound.UpdateProperties,changeChildPosRot,whichUpdated={1},newLsi={2}", |
236 | updated.LocalID, whichUpdated, newLsi); | 236 | updated.LocalID, whichUpdated, newLsi); |
237 | updated.LinksetInfo = newLsi; | 237 | updated.LinksetInfo = newLsi; |
238 | updatedChild = true; | 238 | updatedChild = true; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 8de8905..75eed86 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -110,6 +110,7 @@ public static class BSParam | |||
110 | return (Vector3)vehicleAngularFactorV; | 110 | return (Vector3)vehicleAngularFactorV; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | public static float VehicleGroundGravityFudge { get; private set; } | ||
113 | public static float VehicleDebuggingEnabled { get; private set; } | 114 | public static float VehicleDebuggingEnabled { get; private set; } |
114 | 115 | ||
115 | public static float LinksetImplementation { get; private set; } | 116 | public static float LinksetImplementation { get; private set; } |
@@ -480,12 +481,12 @@ public static class BSParam | |||
480 | (s) => { return VehicleAngularDamping; }, | 481 | (s) => { return VehicleAngularDamping; }, |
481 | (s,p,l,v) => { VehicleAngularDamping = v; } ), | 482 | (s,p,l,v) => { VehicleAngularDamping = v; } ), |
482 | new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", | 483 | new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", |
483 | 0.2f, | 484 | 1.0f, |
484 | (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, | 485 | (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, |
485 | (s) => { return VehicleLinearFactor; }, | 486 | (s) => { return VehicleLinearFactor; }, |
486 | (s,p,l,v) => { VehicleLinearFactor = v; } ), | 487 | (s,p,l,v) => { VehicleLinearFactor = v; } ), |
487 | new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", | 488 | new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", |
488 | 0.2f, | 489 | 1.0f, |
489 | (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, | 490 | (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, |
490 | (s) => { return VehicleAngularFactor; }, | 491 | (s) => { return VehicleAngularFactor; }, |
491 | (s,p,l,v) => { VehicleAngularFactor = v; } ), | 492 | (s,p,l,v) => { VehicleAngularFactor = v; } ), |
@@ -495,10 +496,15 @@ public static class BSParam | |||
495 | (s) => { return VehicleFriction; }, | 496 | (s) => { return VehicleFriction; }, |
496 | (s,p,l,v) => { VehicleFriction = v; } ), | 497 | (s,p,l,v) => { VehicleFriction = v; } ), |
497 | new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", | 498 | new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", |
498 | 0.0f, | 499 | 0.2f, |
499 | (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, | 500 | (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, |
500 | (s) => { return VehicleRestitution; }, | 501 | (s) => { return VehicleRestitution; }, |
501 | (s,p,l,v) => { VehicleRestitution = v; } ), | 502 | (s,p,l,v) => { VehicleRestitution = v; } ), |
503 | new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", | ||
504 | 1.0f, | ||
505 | (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); }, | ||
506 | (s) => { return VehicleGroundGravityFudge; }, | ||
507 | (s,p,l,v) => { VehicleGroundGravityFudge = v; } ), | ||
502 | new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", | 508 | new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", |
503 | ConfigurationParameters.numericFalse, | 509 | ConfigurationParameters.numericFalse, |
504 | (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 510 | (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |