aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2013-01-15 02:58:14 -0800
committerRobert Adams2013-01-15 02:58:14 -0800
commit181d4c6fcbf1560fcf100b5a6ec98d15ad2fe5cc (patch)
tree131316733d6d98effa4dfb67450eee9d9662448c /OpenSim/Region
parentBulletSim: fix logic for enabling unmanaged code debug messages. (diff)
downloadopensim-SC_OLD-181d4c6fcbf1560fcf100b5a6ec98d15ad2fe5cc.zip
opensim-SC_OLD-181d4c6fcbf1560fcf100b5a6ec98d15ad2fe5cc.tar.gz
opensim-SC_OLD-181d4c6fcbf1560fcf100b5a6ec98d15ad2fe5cc.tar.bz2
opensim-SC_OLD-181d4c6fcbf1560fcf100b5a6ec98d15ad2fe5cc.tar.xz
BulletSim: temporarily disable banking and direction deflection
because the computations are wrong. Add VehicleTorqueImpulse routines.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs32
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs7
2 files changed, 29 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index bcebaec..f5826bc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -124,9 +124,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
124 static readonly float PIOverTwo = ((float)Math.PI) / 2f; 124 static readonly float PIOverTwo = ((float)Math.PI) / 2f;
125 125
126 // For debugging, flags to turn on and off individual corrections. 126 // For debugging, flags to turn on and off individual corrections.
127 private bool enableAngularVerticalAttraction = true; 127 private bool enableAngularVerticalAttraction;
128 private bool enableAngularDeflection = true; 128 private bool enableAngularDeflection;
129 private bool enableAngularBanking = true; 129 private bool enableAngularBanking;
130 130
131 public BSDynamics(BSScene myScene, BSPrim myPrim) 131 public BSDynamics(BSScene myScene, BSPrim myPrim)
132 { 132 {
@@ -141,8 +141,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
141 public void SetupVehicleDebugging() 141 public void SetupVehicleDebugging()
142 { 142 {
143 enableAngularVerticalAttraction = true; 143 enableAngularVerticalAttraction = true;
144 enableAngularDeflection = true; 144 enableAngularDeflection = false;
145 enableAngularBanking = true; 145 enableAngularBanking = false;
146 if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) 146 if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse)
147 { 147 {
148 enableAngularVerticalAttraction = false; 148 enableAngularVerticalAttraction = false;
@@ -649,6 +649,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
649 private Quaternion m_knownOrientation; 649 private Quaternion m_knownOrientation;
650 private Vector3 m_knownRotationalVelocity; 650 private Vector3 m_knownRotationalVelocity;
651 private Vector3 m_knownRotationalForce; 651 private Vector3 m_knownRotationalForce;
652 private Vector3 m_knownRotationalImpulse;
652 private Vector3 m_knownForwardVelocity; // vehicle relative forward speed 653 private Vector3 m_knownForwardVelocity; // vehicle relative forward speed
653 654
654 private const int m_knownChangedPosition = 1 << 0; 655 private const int m_knownChangedPosition = 1 << 0;
@@ -658,9 +659,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
658 private const int m_knownChangedOrientation = 1 << 4; 659 private const int m_knownChangedOrientation = 1 << 4;
659 private const int m_knownChangedRotationalVelocity = 1 << 5; 660 private const int m_knownChangedRotationalVelocity = 1 << 5;
660 private const int m_knownChangedRotationalForce = 1 << 6; 661 private const int m_knownChangedRotationalForce = 1 << 6;
661 private const int m_knownChangedTerrainHeight = 1 << 7; 662 private const int m_knownChangedRotationalImpulse = 1 << 7;
662 private const int m_knownChangedWaterLevel = 1 << 8; 663 private const int m_knownChangedTerrainHeight = 1 << 8;
663 private const int m_knownChangedForwardVelocity = 1 << 9; 664 private const int m_knownChangedWaterLevel = 1 << 9;
665 private const int m_knownChangedForwardVelocity = 1 <<10;
664 666
665 private void ForgetKnownVehicleProperties() 667 private void ForgetKnownVehicleProperties()
666 { 668 {
@@ -700,6 +702,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
700 PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity); 702 PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity);
701 } 703 }
702 704
705 if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0)
706 Prim.ApplyTorqueImpulse((Vector3)m_knownRotationalImpulse, true /*inTaintTime*/);
707
703 if ((m_knownChanged & m_knownChangedRotationalForce) != 0) 708 if ((m_knownChanged & m_knownChangedRotationalForce) != 0)
704 { 709 {
705 Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); 710 Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/);
@@ -843,6 +848,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin
843 m_knownChanged |= m_knownChangedRotationalForce; 848 m_knownChanged |= m_knownChangedRotationalForce;
844 m_knownHas |= m_knownChangedRotationalForce; 849 m_knownHas |= m_knownChangedRotationalForce;
845 } 850 }
851 private void VehicleAddRotationalImpulse(Vector3 pImpulse)
852 {
853 if ((m_knownHas & m_knownChangedRotationalImpulse) == 0)
854 {
855 m_knownRotationalImpulse = Vector3.Zero;
856 m_knownHas |= m_knownChangedRotationalImpulse;
857 }
858 m_knownRotationalImpulse += pImpulse;
859 m_knownChanged |= m_knownChangedRotationalImpulse;
860 }
861
846 // Vehicle relative forward velocity 862 // Vehicle relative forward velocity
847 private Vector3 VehicleForwardVelocity 863 private Vector3 VehicleForwardVelocity
848 { 864 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 5a1b5c7..2dc89b5 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -195,8 +195,11 @@ public sealed class BSLinksetCompound : BSLinkset
195 && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) 195 && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
196 { 196 {
197 // TODO: replace this with are calculation of the child prim's orientation and pos. 197 // TODO: replace this with are calculation of the child prim's orientation and pos.
198 updated.LinksetInfo = null; 198 // TODO: for the moment, don't rebuild the compound shape.
199 ScheduleRebuild(updated); 199 // This is often just the car turning its wheels. When we can just reorient the one
200 // member shape of the compound shape, the overhead of rebuilding won't be a problem.
201 // updated.LinksetInfo = null;
202 // ScheduleRebuild(updated);
200 } 203 }
201 } 204 }
202 205