aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs29
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs9
2 files changed, 22 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index dbc9039..a121c3d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -518,13 +518,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin
518 { 518 {
519 if (IsActive) 519 if (IsActive)
520 { 520 {
521 VDetailLog("{0},BSDynamics.Refresh", Prim.LocalID);
522 m_vehicleMass = Prim.Linkset.LinksetMass;
523
521 // Friction effects are handled by this vehicle code 524 // Friction effects are handled by this vehicle code
522 BulletSimAPI.SetFriction2(Prim.PhysBody.ptr, 0f); 525 BulletSimAPI.SetFriction2(Prim.PhysBody.ptr, 0f);
523 BulletSimAPI.SetHitFraction2(Prim.PhysBody.ptr, 0f); 526 BulletSimAPI.SetHitFraction2(Prim.PhysBody.ptr, 0f);
524 527
525 // BulletSimAPI.SetAngularDamping2(Prim.PhysBody.ptr, 0.8f); 528 BulletSimAPI.SetAngularDamping2(Prim.PhysBody.ptr, 0.8f);
529
530 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, new Vector3(1f, 1f, 1f));
531
526 532
527 VDetailLog("{0},BSDynamics.Refresh,zeroingFriction and adding damping", Prim.LocalID);
528 } 533 }
529 } 534 }
530 535
@@ -560,8 +565,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
560 // m_lastLinearVelocityVector = Prim.ForceVelocity * Quaternion.Inverse(Prim.ForceOrientation); // DEBUG: 565 // m_lastLinearVelocityVector = Prim.ForceVelocity * Quaternion.Inverse(Prim.ForceOrientation); // DEBUG:
561 // END DEBUG 566 // END DEBUG
562 567
563 m_vehicleMass = Prim.Linkset.LinksetMass;
564
565 MoveLinear(pTimestep); 568 MoveLinear(pTimestep);
566 // Commented out for debug 569 // Commented out for debug
567 MoveAngular(pTimestep); 570 MoveAngular(pTimestep);
@@ -650,6 +653,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
650 // if (rotatedSize.Z < terrainHeight) 653 // if (rotatedSize.Z < terrainHeight)
651 if (pos.Z < terrainHeight) 654 if (pos.Z < terrainHeight)
652 { 655 {
656 // TODO: correct position by applying force rather than forcing position.
653 pos.Z = terrainHeight + 2; 657 pos.Z = terrainHeight + 2;
654 Prim.ForcePosition = pos; 658 Prim.ForcePosition = pos;
655 VDetailLog("{0},MoveLinear,terrainHeight,terrainHeight={1},pos={2}", Prim.LocalID, terrainHeight, pos); 659 VDetailLog("{0},MoveLinear,terrainHeight,terrainHeight={1},pos={2}", Prim.LocalID, terrainHeight, pos);
@@ -810,9 +814,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
810 private void MoveAngular(float pTimestep) 814 private void MoveAngular(float pTimestep)
811 { 815 {
812 // m_angularMotorDirection // angular velocity requested by LSL motor 816 // m_angularMotorDirection // angular velocity requested by LSL motor
813 // m_angularMotorApply // application frame counter
814 // m_angularMotorVelocity // current angular motor velocity (ramps up and down) 817 // m_angularMotorVelocity // current angular motor velocity (ramps up and down)
815 // m_angularMotorTimescale // motor angular velocity ramp up rate 818 // m_angularMotorTimescale // motor angular velocity ramp up time
816 // m_angularMotorDecayTimescale // motor angular velocity decay rate 819 // m_angularMotorDecayTimescale // motor angular velocity decay rate
817 // m_angularFrictionTimescale // body angular velocity decay rate 820 // m_angularFrictionTimescale // body angular velocity decay rate
818 // m_lastAngularVelocity // what was last applied to body 821 // m_lastAngularVelocity // what was last applied to body
@@ -847,7 +850,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
847 { 850 {
848 float VAservo = pTimestep * 0.2f / m_verticalAttractionTimescale; 851 float VAservo = pTimestep * 0.2f / m_verticalAttractionTimescale;
849 if (Prim.IsColliding) 852 if (Prim.IsColliding)
850 VAservo = pTimestep * 0.05f / (m_verticalAttractionTimescale); 853 VAservo = pTimestep * 0.05f / m_verticalAttractionTimescale;
851 854
852 VAservo *= (m_verticalAttractionEfficiency * m_verticalAttractionEfficiency); 855 VAservo *= (m_verticalAttractionEfficiency * m_verticalAttractionEfficiency);
853 856
@@ -925,6 +928,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
925 float mix = Math.Abs(m_bankingMix); 928 float mix = Math.Abs(m_bankingMix);
926 if (m_angularMotorVelocity.X == 0) 929 if (m_angularMotorVelocity.X == 0)
927 { 930 {
931 // The vehicle is stopped
928 /*if (!parent.Orientation.ApproxEquals(this.m_referenceFrame, 0.25f)) 932 /*if (!parent.Orientation.ApproxEquals(this.m_referenceFrame, 0.25f))
929 { 933 {
930 Vector3 axisAngle; 934 Vector3 axisAngle;
@@ -938,9 +942,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
938 }*/ 942 }*/
939 } 943 }
940 else 944 else
941 banking.Z += (effSquared*(mult*mix))*(m_angularMotorVelocity.X) * 4; 945 {
946 banking.Z += (effSquared * (mult * mix)) * (m_angularMotorVelocity.X) * 4;
947 }
948
949 //If they are colliding, we probably shouldn't shove the prim around... probably
942 if (!Prim.IsColliding && Math.Abs(m_angularMotorVelocity.X) > mix) 950 if (!Prim.IsColliding && Math.Abs(m_angularMotorVelocity.X) > mix)
943 //If they are colliding, we probably shouldn't shove the prim around... probably
944 { 951 {
945 float angVelZ = m_angularMotorVelocity.X*-1; 952 float angVelZ = m_angularMotorVelocity.X*-1;
946 /*if(angVelZ > mix) 953 /*if(angVelZ > mix)
@@ -957,8 +964,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
957 banking += bankingRot; 964 banking += bankingRot;
958 } 965 }
959 m_angularMotorVelocity.X *= m_bankingEfficiency == 1 ? 0.0f : 1 - m_bankingEfficiency; 966 m_angularMotorVelocity.X *= m_bankingEfficiency == 1 ? 0.0f : 1 - m_bankingEfficiency;
960 VDetailLog("{0},MoveAngular,Banking,bEff={1},angMotVel={2},banking={3}", 967 VDetailLog("{0},MoveAngular,Banking,bEff={1},angMotVel={2},effSq={3},mult={4},mix={5},banking={6}",
961 Prim.LocalID, m_bankingEfficiency, m_angularMotorVelocity, banking); 968 Prim.LocalID, m_bankingEfficiency, m_angularMotorVelocity, effSquared, mult, mix, banking);
962 } 969 }
963 970
964 #endregion 971 #endregion
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 2b3fa25..caa6c46 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -342,13 +342,12 @@ public sealed class BSPrim : BSPhysObject
342 // TODO: check for out of bounds 342 // TODO: check for out of bounds
343 343
344 // The above code computes a force to apply to correct any out-of-bounds problems. Apply same. 344 // The above code computes a force to apply to correct any out-of-bounds problems. Apply same.
345 // TODO: This should be intergrated with a geneal physics action mechanism.
346 // TODO: This should be moderated with PID'ness.
345 if (ret) 347 if (ret)
346 { 348 {
347 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.PositionSanityCheck:belowTerrain", delegate() 349 // Apply upforce and overcome gravity.
348 { 350 AddForce(upForce - PhysicsScene.DefaultGravity, false, inTaintTime);
349 // Apply upforce and overcome gravity.
350 ForceVelocity = ForceVelocity + upForce - PhysicsScene.DefaultGravity;
351 });
352 } 351 }
353 return ret; 352 return ret;
354 } 353 }