diff options
author | Robert Adams | 2013-01-11 16:36:34 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-11 16:47:53 -0800 |
commit | 459fcd81c9d6e7c92738b40f1b4b4fe746699379 (patch) | |
tree | 6555a0076aa18c3634ad89ef8c3d097d67edb08b /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |
parent | BulletSim: add osGetPhysicsEngineType() LSL function and update (diff) | |
download | opensim-SC-459fcd81c9d6e7c92738b40f1b4b4fe746699379.zip opensim-SC-459fcd81c9d6e7c92738b40f1b4b4fe746699379.tar.gz opensim-SC-459fcd81c9d6e7c92738b40f1b4b4fe746699379.tar.bz2 opensim-SC-459fcd81c9d6e7c92738b40f1b4b4fe746699379.tar.xz |
BulletSim: move center of gravity of linkset to its geometric center.
Necessitated allowing simulator and physical position of a body to
get out of sync since Bullet assumes that <0,0,0> is the center of mass.
Update DLLs and SOs for the UpdateChildTransform so positions of
individual prim in a linkset can be implemented.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 80fdfb9..bcebaec 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -148,7 +148,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
148 | enableAngularVerticalAttraction = false; | 148 | enableAngularVerticalAttraction = false; |
149 | enableAngularDeflection = false; | 149 | enableAngularDeflection = false; |
150 | enableAngularBanking = false; | 150 | enableAngularBanking = false; |
151 | VDetailLog("{0},BSDynamics.SetupVehicleDebugging,settingDebugMode", Prim.LocalID); | ||
152 | } | 151 | } |
153 | } | 152 | } |
154 | 153 | ||
@@ -690,10 +689,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
690 | } | 689 | } |
691 | 690 | ||
692 | if ((m_knownChanged & m_knownChangedForce) != 0) | 691 | if ((m_knownChanged & m_knownChangedForce) != 0) |
693 | Prim.AddForce((Vector3)m_knownForce, false, true); | 692 | Prim.AddForce((Vector3)m_knownForce, false /*pushForce*/, true /*inTaintTime*/); |
694 | 693 | ||
695 | if ((m_knownChanged & m_knownChangedForceImpulse) != 0) | 694 | if ((m_knownChanged & m_knownChangedForceImpulse) != 0) |
696 | Prim.AddForceImpulse((Vector3)m_knownForceImpulse, false, true); | 695 | Prim.AddForceImpulse((Vector3)m_knownForceImpulse, false /*pushforce*/, true /*inTaintTime*/); |
697 | 696 | ||
698 | if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0) | 697 | if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0) |
699 | { | 698 | { |
@@ -703,7 +702,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
703 | 702 | ||
704 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) | 703 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) |
705 | { | 704 | { |
706 | Prim.AddAngularForce((Vector3)m_knownRotationalForce, false, true); | 705 | Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); |
707 | } | 706 | } |
708 | 707 | ||
709 | // If we set one of the values (ie, the physics engine didn't do it) we must force | 708 | // If we set one of the values (ie, the physics engine didn't do it) we must force |
@@ -970,7 +969,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
970 | // Act against the inertia of the vehicle | 969 | // Act against the inertia of the vehicle |
971 | linearMotorForce *= m_vehicleMass; | 970 | linearMotorForce *= m_vehicleMass; |
972 | 971 | ||
973 | VehicleAddForceImpulse(linearMotorForce); | 972 | VehicleAddForceImpulse(linearMotorForce * pTimestep); |
974 | 973 | ||
975 | VDetailLog("{0}, MoveLinear,velocity,vehVel={1},step={2},stepVel={3},mix={4},force={5}", | 974 | VDetailLog("{0}, MoveLinear,velocity,vehVel={1},step={2},stepVel={3},mix={4},force={5}", |
976 | Prim.LocalID, VehicleVelocity, linearMotorStep, linearMotorVelocity, mixFactor, linearMotorForce); | 975 | Prim.LocalID, VehicleVelocity, linearMotorStep, linearMotorVelocity, mixFactor, linearMotorForce); |
@@ -1033,7 +1032,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1033 | { | 1032 | { |
1034 | // Error is positive if below the target and negative if above. | 1033 | // Error is positive if below the target and negative if above. |
1035 | float verticalError = m_VhoverTargetHeight - VehiclePosition.Z; | 1034 | float verticalError = m_VhoverTargetHeight - VehiclePosition.Z; |
1036 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale; | 1035 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale * pTimestep; |
1037 | 1036 | ||
1038 | // TODO: implement m_VhoverEfficiency correctly | 1037 | // TODO: implement m_VhoverEfficiency correctly |
1039 | VehicleAddForceImpulse(new Vector3(0f, 0f, verticalCorrectionVelocity)); | 1038 | VehicleAddForceImpulse(new Vector3(0f, 0f, verticalCorrectionVelocity)); |
@@ -1323,7 +1322,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1323 | // this creates an over-correction and then wabbling as the target is overshot. | 1322 | // this creates an over-correction and then wabbling as the target is overshot. |
1324 | // TODO: rethink how the different correction computations inter-relate. | 1323 | // TODO: rethink how the different correction computations inter-relate. |
1325 | 1324 | ||
1326 | if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleVelocity != Vector3.Zero) | 1325 | if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2) |
1327 | { | 1326 | { |
1328 | // The direction the vehicle is moving | 1327 | // The direction the vehicle is moving |
1329 | Vector3 movingDirection = VehicleVelocity; | 1328 | Vector3 movingDirection = VehicleVelocity; |