diff options
author | Robert Adams | 2013-01-15 04:24:24 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-15 04:24:24 -0800 |
commit | 021964c6e0648cf0e75b46864bef55afb7ff0a1f (patch) | |
tree | 1c923355873e4bc07df14c66779a6684c83bba4d /OpenSim/Region/Physics/BulletSPlugin | |
parent | BulletSim: temporarily disable banking and direction deflection (diff) | |
download | opensim-SC_OLD-021964c6e0648cf0e75b46864bef55afb7ff0a1f.zip opensim-SC_OLD-021964c6e0648cf0e75b46864bef55afb7ff0a1f.tar.gz opensim-SC_OLD-021964c6e0648cf0e75b46864bef55afb7ff0a1f.tar.bz2 opensim-SC_OLD-021964c6e0648cf0e75b46864bef55afb7ff0a1f.tar.xz |
BulletSim: tweeks to improve hover.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index f5826bc..e434412 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1047,16 +1047,32 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1047 | else | 1047 | else |
1048 | { | 1048 | { |
1049 | // Error is positive if below the target and negative if above. | 1049 | // Error is positive if below the target and negative if above. |
1050 | float verticalError = m_VhoverTargetHeight - VehiclePosition.Z; | 1050 | Vector3 hpos = VehiclePosition; |
1051 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale * pTimestep; | 1051 | float verticalError = m_VhoverTargetHeight - hpos.Z; |
1052 | float verticalCorrection = verticalError / m_VhoverTimescale; | ||
1053 | verticalCorrection *= m_VhoverEfficiency; | ||
1054 | |||
1055 | hpos.Z += verticalCorrection; | ||
1056 | VehiclePosition = hpos; | ||
1057 | |||
1058 | // Since we are hovering, we need to do the opposite of falling -- get rid of world Z | ||
1059 | Vector3 vel = VehicleVelocity; | ||
1060 | vel.Z = 0f; | ||
1061 | VehicleVelocity = vel; | ||
1062 | |||
1063 | /* | ||
1064 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale; | ||
1065 | Vector3 verticalCorrection = new Vector3(0f, 0f, verticalCorrectionVelocity); | ||
1066 | verticalCorrection *= m_vehicleMass; | ||
1052 | 1067 | ||
1053 | // TODO: implement m_VhoverEfficiency correctly | 1068 | // TODO: implement m_VhoverEfficiency correctly |
1054 | VehicleAddForceImpulse(new Vector3(0f, 0f, verticalCorrectionVelocity)); | 1069 | VehicleAddForceImpulse(verticalCorrection); |
1070 | */ | ||
1055 | 1071 | ||
1056 | VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corrVel={7}", | 1072 | VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corr={7}", |
1057 | Prim.LocalID, VehiclePosition, m_VhoverEfficiency, | 1073 | Prim.LocalID, VehiclePosition, m_VhoverEfficiency, |
1058 | m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, | 1074 | m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, |
1059 | verticalError, verticalCorrectionVelocity); | 1075 | verticalError, verticalCorrection); |
1060 | } | 1076 | } |
1061 | 1077 | ||
1062 | } | 1078 | } |