aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs21
1 files changed, 8 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index f8fc3de..dbe44de 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1192 // set directly on the vehicle. 1192 // set directly on the vehicle.
1193 private void MoveAngular(float pTimestep) 1193 private void MoveAngular(float pTimestep)
1194 { 1194 {
1195 VehicleRotationalVelocity = Vector3.Zero; 1195 // VehicleRotationalVelocity = Vector3.Zero;
1196 1196
1197 ComputeAngularTurning(pTimestep); 1197 ComputeAngularTurning(pTimestep);
1198 1198
@@ -1203,12 +1203,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1203 ComputeAngularBanking(); 1203 ComputeAngularBanking();
1204 1204
1205 // ================================================================== 1205 // ==================================================================
1206 // All of the above computation are made relative to vehicle coordinates.
1207 // Convert to world coordinates.
1208 // TODO: Should this be applied as an angular force (torque)?
1209 VehicleRotationalVelocity *= VehicleOrientation;
1210
1211 // ==================================================================
1212 if (VehicleRotationalVelocity.ApproxEquals(Vector3.Zero, 0.01f)) 1206 if (VehicleRotationalVelocity.ApproxEquals(Vector3.Zero, 0.01f))
1213 { 1207 {
1214 // The vehicle is not adding anything angular wise. 1208 // The vehicle is not adding anything angular wise.
@@ -1256,7 +1250,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1256 private void ComputeAngularTurning(float pTimestep) 1250 private void ComputeAngularTurning(float pTimestep)
1257 { 1251 {
1258 // The user wants this many radians per second angular change? 1252 // The user wants this many radians per second angular change?
1259 Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep); 1253 Vector3 currentAngular = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation);
1254 Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep, currentAngular);
1260 1255
1261 // ================================================================== 1256 // ==================================================================
1262 // From http://wiki.secondlife.com/wiki/LlSetVehicleFlags : 1257 // From http://wiki.secondlife.com/wiki/LlSetVehicleFlags :
@@ -1272,7 +1267,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1272 angularMotorContribution.Y = 0f; 1267 angularMotorContribution.Y = 0f;
1273 } 1268 }
1274 1269
1275 VehicleRotationalVelocity += angularMotorContribution; 1270 VehicleRotationalVelocity += angularMotorContribution * VehicleOrientation;
1276 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", Prim.LocalID, angularMotorContribution); 1271 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", Prim.LocalID, angularMotorContribution);
1277 } 1272 }
1278 1273
@@ -1312,7 +1307,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1312 if (verticalError.Z < 0f) 1307 if (verticalError.Z < 0f)
1313 { 1308 {
1314 vertContribution.X += PIOverFour; 1309 vertContribution.X += PIOverFour;
1315 vertContribution.Y += PIOverFour; 1310 // vertContribution.Y -= PIOverFour;
1316 } 1311 }
1317 1312
1318 // 'vertContrbution' is now the necessary angular correction to correct tilt in one second. 1313 // 'vertContrbution' is now the necessary angular correction to correct tilt in one second.
@@ -1320,7 +1315,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1320 Vector3 unscaledContrib = vertContribution; // DEBUG DEBUG 1315 Vector3 unscaledContrib = vertContribution; // DEBUG DEBUG
1321 vertContribution /= m_verticalAttractionTimescale; 1316 vertContribution /= m_verticalAttractionTimescale;
1322 1317
1323 VehicleRotationalVelocity += vertContribution; 1318 VehicleRotationalVelocity += vertContribution * VehicleOrientation;
1324 1319
1325 VDetailLog("{0}, MoveAngular,verticalAttraction,,verticalError={1},unscaled={2},eff={3},ts={4},vertAttr={5}", 1320 VDetailLog("{0}, MoveAngular,verticalAttraction,,verticalError={1},unscaled={2},eff={3},ts={4},vertAttr={5}",
1326 Prim.LocalID, verticalError, unscaledContrib, m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContribution); 1321 Prim.LocalID, verticalError, unscaledContrib, m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContribution);
@@ -1371,7 +1366,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1371 deflectContribution = (-deflectionError) * m_angularDeflectionEfficiency; 1366 deflectContribution = (-deflectionError) * m_angularDeflectionEfficiency;
1372 deflectContribution /= m_angularDeflectionTimescale; 1367 deflectContribution /= m_angularDeflectionTimescale;
1373 1368
1374 VehicleRotationalVelocity += deflectContribution; 1369 VehicleRotationalVelocity += deflectContribution * VehicleOrientation;
1375 1370
1376 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}", 1371 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}",
1377 Prim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContribution); 1372 Prim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContribution);
@@ -1438,7 +1433,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1438 // Don't do it all at once. 1433 // Don't do it all at once.
1439 bankingContribution /= m_bankingTimescale; 1434 bankingContribution /= m_bankingTimescale;
1440 1435
1441 VehicleRotationalVelocity += bankingContribution; 1436 VehicleRotationalVelocity += bankingContribution * VehicleOrientation;
1442 1437
1443 VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}", 1438 VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}",
1444 Prim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContribution); 1439 Prim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContribution);