diff options
author | Robert Adams | 2013-01-08 16:09:15 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-08 16:37:49 -0800 |
commit | df1d7414adbf329e139201cdb7578c7b64bb50c8 (patch) | |
tree | 74bed23a9c71702e52b4e6cc156176267ca71dcd /OpenSim/Region/Physics/BulletSPlugin | |
parent | minor: Fix command match of "debug script" command to "debug scripts" to matc... (diff) | |
download | opensim-SC_OLD-df1d7414adbf329e139201cdb7578c7b64bb50c8.zip opensim-SC_OLD-df1d7414adbf329e139201cdb7578c7b64bb50c8.tar.gz opensim-SC_OLD-df1d7414adbf329e139201cdb7578c7b64bb50c8.tar.bz2 opensim-SC_OLD-df1d7414adbf329e139201cdb7578c7b64bb50c8.tar.xz |
BulletSim: Fix hover height (boats float at the correct level).
Fix problem of vehicles going crazy when backing up.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 16 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index eb695d9..c34c05a 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -856,6 +856,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
856 | // The movement computed in the linear motor is relative to the vehicle | 856 | // The movement computed in the linear motor is relative to the vehicle |
857 | // coordinates. Rotate the movement to world coordinates. | 857 | // coordinates. Rotate the movement to world coordinates. |
858 | linearMotorContribution *= VehicleOrientation; | 858 | linearMotorContribution *= VehicleOrientation; |
859 | // All the contributions after this are world relative (mostly Z modifications) | ||
859 | 860 | ||
860 | // ================================================================== | 861 | // ================================================================== |
861 | // Buoyancy: force to overcome gravity. | 862 | // Buoyancy: force to overcome gravity. |
@@ -982,14 +983,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
982 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale; | 983 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale; |
983 | 984 | ||
984 | // TODO: implement m_VhoverEfficiency correctly | 985 | // TODO: implement m_VhoverEfficiency correctly |
985 | if (Math.Abs(verticalError) > m_VhoverEfficiency) | 986 | ret = new Vector3(0f, 0f, verticalCorrectionVelocity); |
986 | { | ||
987 | ret = new Vector3(0f, 0f, verticalCorrectionVelocity); | ||
988 | } | ||
989 | } | 987 | } |
990 | 988 | ||
991 | VDetailLog("{0}, MoveLinear,hover,pos={1},ret={2},hoverTS={3},height={4},target={5}", | 989 | VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},ret={6}", |
992 | Prim.LocalID, VehiclePosition, ret, m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight); | 990 | Prim.LocalID, VehiclePosition, m_VhoverEfficiency, m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, ret); |
993 | } | 991 | } |
994 | 992 | ||
995 | return ret; | 993 | return ret; |
@@ -1238,6 +1236,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1238 | Vector3 movingDirection = VehicleVelocity; | 1236 | Vector3 movingDirection = VehicleVelocity; |
1239 | movingDirection.Normalize(); | 1237 | movingDirection.Normalize(); |
1240 | 1238 | ||
1239 | // If the vehicle is going backward, it is still pointing forward | ||
1240 | movingDirection *= Math.Sign(VehicleForwardSpeed); | ||
1241 | |||
1241 | // The direction the vehicle is pointing | 1242 | // The direction the vehicle is pointing |
1242 | Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; | 1243 | Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; |
1243 | pointingDirection.Normalize(); | 1244 | pointingDirection.Normalize(); |
@@ -1246,6 +1247,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1246 | Vector3 deflectionError = movingDirection - pointingDirection; | 1247 | Vector3 deflectionError = movingDirection - pointingDirection; |
1247 | 1248 | ||
1248 | // Don't try to correct very large errors (not our job) | 1249 | // Don't try to correct very large errors (not our job) |
1250 | // if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = PIOverTwo * Math.Sign(deflectionError.X); | ||
1251 | // if (Math.Abs(deflectionError.Y) > PIOverFour) deflectionError.Y = PIOverTwo * Math.Sign(deflectionError.Y); | ||
1252 | // if (Math.Abs(deflectionError.Z) > PIOverFour) deflectionError.Z = PIOverTwo * Math.Sign(deflectionError.Z); | ||
1249 | if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = 0f; | 1253 | if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = 0f; |
1250 | if (Math.Abs(deflectionError.Y) > PIOverFour) deflectionError.Y = 0f; | 1254 | if (Math.Abs(deflectionError.Y) > PIOverFour) deflectionError.Y = 0f; |
1251 | if (Math.Abs(deflectionError.Z) > PIOverFour) deflectionError.Z = 0f; | 1255 | if (Math.Abs(deflectionError.Z) > PIOverFour) deflectionError.Z = 0f; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 794a6af..29bd4e4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,9 +1,9 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | Avatars walking up stairs | 3 | Avatars walking up stairs (HALF DONE) |
4 | Vehicle movement on terrain smoothness | 4 | Vehicle movement on terrain smoothness |
5 | limitMotorUp calibration (more down?) | 5 | limitMotorUp calibration (more down?) |
6 | Preferred orientatino angular correction fix | 6 | Preferred orientation angular correction fix |
7 | Surfboard go wonky when turning | 7 | Surfboard go wonky when turning |
8 | Angular motor direction is global coordinates rather than local coordinates? | 8 | Angular motor direction is global coordinates rather than local coordinates? |
9 | Boats float low in the water | 9 | Boats float low in the water |