aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
authorBlueWall2012-12-12 16:15:32 -0500
committerBlueWall2012-12-12 16:15:32 -0500
commitc5d333c16cddbcbcceb1ed0bc937e5775c99c2bc (patch)
tree644d21cbd5b7e86d9ba3316979fd9a85bc028f51 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
parentReplace Mono.Addins libraries (diff)
parentBulletSim: do not return the current velocity for targetVelocity. (diff)
downloadopensim-SC-c5d333c16cddbcbcceb1ed0bc937e5775c99c2bc.zip
opensim-SC-c5d333c16cddbcbcceb1ed0bc937e5775c99c2bc.tar.gz
opensim-SC-c5d333c16cddbcbcceb1ed0bc937e5775c99c2bc.tar.bz2
opensim-SC-c5d333c16cddbcbcceb1ed0bc937e5775c99c2bc.tar.xz
Merge branch 'master' of /home/opensim/var/repo/opensim
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index fa3110c..82e829e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -570,8 +570,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
570 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); 570 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia);
571 BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr); 571 BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr);
572 572
573 VDetailLog("{0},BSDynamics.Refresh,frict={1},inert={2},aDamp={3}", 573 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}",
574 Prim.LocalID, friction, localInertia, angularDamping); 574 Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping);
575 } 575 }
576 else 576 else
577 { 577 {
@@ -818,6 +818,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
818 + hoverContribution 818 + hoverContribution
819 + limitMotorUpContribution; 819 + limitMotorUpContribution;
820 820
821 Vector3 newForce = buoyancyContribution;
822
821 // If not changing some axis, reduce out velocity 823 // If not changing some axis, reduce out velocity
822 if ((m_flags & (VehicleFlag.NO_X)) != 0) 824 if ((m_flags & (VehicleFlag.NO_X)) != 0)
823 newVelocity.X = 0; 825 newVelocity.X = 0;
@@ -845,7 +847,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
845 VehicleVelocity = newVelocity; 847 VehicleVelocity = newVelocity;
846 848
847 // Other linear forces are applied as forces. 849 // Other linear forces are applied as forces.
848 Vector3 totalDownForce = buoyancyContribution * m_vehicleMass; 850 Vector3 totalDownForce = newForce * m_vehicleMass;
849 if (!totalDownForce.ApproxEquals(Vector3.Zero, 0.01f)) 851 if (!totalDownForce.ApproxEquals(Vector3.Zero, 0.01f))
850 { 852 {
851 VehicleAddForce(totalDownForce); 853 VehicleAddForce(totalDownForce);
@@ -991,8 +993,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
991 993
992 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0) 994 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
993 { 995 {
994 // If the vehicle is motoring into the sky, get it going back down. 996 float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition);
995 float distanceAboveGround = VehiclePosition.Z - GetTerrainHeight(VehiclePosition); 997 float distanceAboveGround = VehiclePosition.Z - targetHeight;
996 // Not colliding if the vehicle is off the ground 998 // Not colliding if the vehicle is off the ground
997 if (!Prim.IsColliding) 999 if (!Prim.IsColliding)
998 { 1000 {
@@ -1005,8 +1007,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1005 // has a decay factor. This says this force should 1007 // has a decay factor. This says this force should
1006 // be computed with a motor. 1008 // be computed with a motor.
1007 // TODO: add interaction with banking. 1009 // TODO: add interaction with banking.
1008 VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},downForce={2}", 1010 VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},colliding={2},ret={3}",
1009 Prim.LocalID, distanceAboveGround, ret); 1011 Prim.LocalID, distanceAboveGround, Prim.IsColliding, ret);
1010 } 1012 }
1011 return ret; 1013 return ret;
1012 } 1014 }
@@ -1055,7 +1057,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1055 // TODO: Should this be applied as an angular force (torque)? 1057 // TODO: Should this be applied as an angular force (torque)?
1056 if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f)) 1058 if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f))
1057 { 1059 {
1058 Vector3 scaledCorrection = m_lastAngularCorrection * pTimestep; 1060 // DEBUG DEBUG DEBUG: optionally scale the angular velocity. Debugging SL vs ODE turning functions.
1061 Vector3 scaledCorrection = m_lastAngularCorrection;
1062 if (PhysicsScene.VehicleScaleAngularVelocityByTimestep)
1063 scaledCorrection *= pTimestep;
1059 VehicleRotationalVelocity = scaledCorrection; 1064 VehicleRotationalVelocity = scaledCorrection;
1060 1065
1061 VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}", 1066 VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}",