From 42d65840c843f2cac6f02fc1b6012140c9cb240e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 29 Oct 2012 14:32:07 -0700 Subject: [PATCH] BulletSim: Add gravity force to vehicle. Some debugging additions. --- OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 8bd81173d5..4981007a5f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs @@ -539,6 +539,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin { if (!IsActive) return; + m_lastAngularVelocity = Prim.ForceRotationalVelocity; // DEBUG: account for what Bullet did last time + MoveLinear(pTimestep); MoveAngular(pTimestep); LimitRotation(pTimestep); @@ -558,7 +560,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin Prim.ForceOrientation = newOrientation; } */ - BulletSimAPI.SetInterpolationVelocity2(Prim.BSBody.ptr, m_newVelocity, m_lastAngularVelocity); + // DEBUG: Trying to figure out why Bullet goes crazy when the root prim is moved. + BulletSimAPI.SetInterpolationVelocity2(Prim.BSBody.ptr, m_newVelocity, m_lastAngularVelocity); // DEBUG DEBUG DEBUG // remember the position so next step we can limit absolute movement effects m_lastPositionVector = Prim.ForcePosition; @@ -762,13 +765,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin // Apply velocity Prim.ForceVelocity = m_newVelocity; // Prim.AddForce(m_newVelocity * Prim.Linkset.LinksetMass, false); - // Prim.AddForce(grav * Prim.Linkset.LinksetMass, false); + Prim.AddForce(grav * Prim.Linkset.LinksetMass, false); VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4}", Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav); } // end MoveLinear() + // ======================================================================= // Apply the effect of the angular motor. private void MoveAngular(float pTimestep) {