diff options
author | Robert Adams | 2013-01-27 12:48:36 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-27 12:50:07 -0800 |
commit | b546af9ac290951f22e8c8e56798adb176076591 (patch) | |
tree | 23f60e1100732357122ffa073c838d8747609507 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |
parent | BulletSim: reinstate the supression of rotational velocity for vehicles (diff) | |
download | opensim-SC-b546af9ac290951f22e8c8e56798adb176076591.zip opensim-SC-b546af9ac290951f22e8c8e56798adb176076591.tar.gz opensim-SC-b546af9ac290951f22e8c8e56798adb176076591.tar.bz2 opensim-SC-b546af9ac290951f22e8c8e56798adb176076591.tar.xz |
BulletSim: simplify the initialization of some of the parameters.
Disable vertical attraction for vehicles by default (for the moment).
Fix bug where vehicle would go crazy when velocity got above a
certain speed.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 90482fd..94194b0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -141,7 +141,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
141 | // in changes by making enablement of debugging flags from INI file. | 141 | // in changes by making enablement of debugging flags from INI file. |
142 | public void SetupVehicleDebugging() | 142 | public void SetupVehicleDebugging() |
143 | { | 143 | { |
144 | enableAngularVerticalAttraction = true; | 144 | enableAngularVerticalAttraction = false; |
145 | enableAngularDeflection = false; | 145 | enableAngularDeflection = false; |
146 | enableAngularBanking = false; | 146 | enableAngularBanking = false; |
147 | if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) | 147 | if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) |
@@ -803,7 +803,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
803 | m_knownVelocity = Prim.ForceVelocity; | 803 | m_knownVelocity = Prim.ForceVelocity; |
804 | m_knownHas |= m_knownChangedVelocity; | 804 | m_knownHas |= m_knownChangedVelocity; |
805 | } | 805 | } |
806 | return (Vector3)m_knownVelocity; | 806 | return m_knownVelocity; |
807 | } | 807 | } |
808 | set | 808 | set |
809 | { | 809 | { |
@@ -926,6 +926,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
926 | // Called after the simulation step | 926 | // Called after the simulation step |
927 | internal void PostStep(float pTimestep) | 927 | internal void PostStep(float pTimestep) |
928 | { | 928 | { |
929 | if (!IsActive) return; | ||
930 | |||
929 | if (PhysicsScene.VehiclePhysicalLoggingEnabled) | 931 | if (PhysicsScene.VehiclePhysicalLoggingEnabled) |
930 | PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, Prim.PhysBody); | 932 | PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, Prim.PhysBody); |
931 | } | 933 | } |
@@ -961,10 +963,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
961 | // ================================================================== | 963 | // ================================================================== |
962 | // Clamp high or low velocities | 964 | // Clamp high or low velocities |
963 | float newVelocityLengthSq = VehicleVelocity.LengthSquared(); | 965 | float newVelocityLengthSq = VehicleVelocity.LengthSquared(); |
964 | if (newVelocityLengthSq > BSParam.VehicleMaxLinearVelocity) | 966 | if (newVelocityLengthSq > BSParam.VehicleMaxLinearVelocitySq) |
965 | { | 967 | { |
968 | Vector3 origVelW = VehicleVelocity; // DEBUG DEBUG | ||
966 | VehicleVelocity /= VehicleVelocity.Length(); | 969 | VehicleVelocity /= VehicleVelocity.Length(); |
967 | VehicleVelocity *= BSParam.VehicleMaxLinearVelocity; | 970 | VehicleVelocity *= BSParam.VehicleMaxLinearVelocity; |
971 | VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}", | ||
972 | Prim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySq, VehicleVelocity); | ||
968 | } | 973 | } |
969 | else if (newVelocityLengthSq < 0.001f) | 974 | else if (newVelocityLengthSq < 0.001f) |
970 | VehicleVelocity = Vector3.Zero; | 975 | VehicleVelocity = Vector3.Zero; |
@@ -1301,6 +1306,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1301 | if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) | 1306 | if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) |
1302 | { | 1307 | { |
1303 | Vector3 vertContributionV = Vector3.Zero; | 1308 | Vector3 vertContributionV = Vector3.Zero; |
1309 | Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG | ||
1304 | 1310 | ||
1305 | // Take a vector pointing up and convert it from world to vehicle relative coords. | 1311 | // Take a vector pointing up and convert it from world to vehicle relative coords. |
1306 | Vector3 verticalError = Vector3.UnitZ * VehicleOrientation; | 1312 | Vector3 verticalError = Vector3.UnitZ * VehicleOrientation; |
@@ -1328,13 +1334,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1328 | 1334 | ||
1329 | // 'vertContrbution' is now the necessary angular correction to correct tilt in one second. | 1335 | // 'vertContrbution' is now the necessary angular correction to correct tilt in one second. |
1330 | // Correction happens over a number of seconds. | 1336 | // Correction happens over a number of seconds. |
1331 | Vector3 unscaledContrib = vertContributionV; // DEBUG DEBUG | 1337 | Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG |
1332 | vertContributionV /= m_verticalAttractionTimescale; | 1338 | vertContributionV /= m_verticalAttractionTimescale; |
1333 | 1339 | ||
1334 | VehicleRotationalVelocity += vertContributionV * VehicleOrientation; | 1340 | VehicleRotationalVelocity += vertContributionV * VehicleOrientation; |
1335 | 1341 | ||
1336 | VDetailLog("{0}, MoveAngular,verticalAttraction,,verticalError={1},unscaled={2},eff={3},ts={4},vertAttr={5}", | 1342 | VDetailLog("{0}, MoveAngular,verticalAttraction,,origRotVW={1},vertError={2},unscaledV={3},eff={4},ts={5},vertContribV={6}", |
1337 | Prim.LocalID, verticalError, unscaledContrib, m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV); | 1343 | Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV, |
1344 | m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV); | ||
1338 | } | 1345 | } |
1339 | } | 1346 | } |
1340 | 1347 | ||