aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2012-02-11 04:42:45 +0000
committerUbitUmarov2012-02-11 04:42:45 +0000
commit33a9f0f1c5aa4cb6b49399dfe6b309b59f77266e (patch)
treee49aecf10e4b314c3623f2ecc759bc823f9baa77 /OpenSim/Region
parentUse mesh to estimate real center of prims if avaiable. Let sculpt map texture... (diff)
downloadopensim-SC_OLD-33a9f0f1c5aa4cb6b49399dfe6b309b59f77266e.zip
opensim-SC_OLD-33a9f0f1c5aa4cb6b49399dfe6b309b59f77266e.tar.gz
opensim-SC_OLD-33a9f0f1c5aa4cb6b49399dfe6b309b59f77266e.tar.bz2
opensim-SC_OLD-33a9f0f1c5aa4cb6b49399dfe6b309b59f77266e.tar.xz
a bit better vertical attractor and banking
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs35
1 files changed, 23 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
index 0272f34..8999621 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
4 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
@@ -161,7 +160,9 @@ namespace OpenSim.Region.Physics.OdePlugin
161 m_angularDeflectionTimescale = pValue; 160 m_angularDeflectionTimescale = pValue;
162 break; 161 break;
163 case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE: 162 case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
164 if (pValue < timestep) pValue = timestep; 163 // if (pValue < timestep) pValue = timestep;
164 // try to make impulses to work a bit better
165 if (pValue < 0.5f) pValue = 0.5f;
165 else if (pValue > 120) pValue = 120; 166 else if (pValue > 120) pValue = 120;
166 m_angularMotorDecayTimescale = pValue * invtimestep; 167 m_angularMotorDecayTimescale = pValue * invtimestep;
167 break; 168 break;
@@ -210,7 +211,9 @@ namespace OpenSim.Region.Physics.OdePlugin
210 m_linearDeflectionTimescale = pValue; 211 m_linearDeflectionTimescale = pValue;
211 break; 212 break;
212 case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE: 213 case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
213 if (pValue < timestep) pValue = timestep; 214 // if (pValue < timestep) pValue = timestep;
215 // try to make impulses to work a bit better
216 if (pValue < 0.5f) pValue = 0.5f;
214 else if (pValue > 120) pValue = 120; 217 else if (pValue > 120) pValue = 120;
215 m_linearMotorDecayTimescale = pValue * invtimestep; 218 m_linearMotorDecayTimescale = pValue * invtimestep;
216 break; 219 break;
@@ -788,38 +791,46 @@ namespace OpenSim.Region.Physics.OdePlugin
788 } 791 }
789 } 792 }
790 793
794 float r;
795 float p;
796 float y;
797 rotq.GetEulerAngles(out r, out p, out y);
798
791 // vertical atractor 799 // vertical atractor
792 if (m_verticalAttractionTimescale < 300) 800 if (m_verticalAttractionTimescale < 300)
793 { 801 {
794 float roll; 802 float roll;
795 float pitch; 803 float pitch;
796 804
797 GetRollPitch(rotq, out roll, out pitch); 805 GetRollPitch(irotq, out roll, out pitch);
798 806
799 float ftmp = 1.0f / m_verticalAttractionTimescale / m_verticalAttractionTimescale / _pParentScene.ODE_STEPSIZE; 807 float ftmp = 1.0f / m_verticalAttractionTimescale / m_verticalAttractionTimescale / _pParentScene.ODE_STEPSIZE;
800 float ftmp2 = m_verticalAttractionEfficiency / _pParentScene.ODE_STEPSIZE; 808 float ftmp2 = m_verticalAttractionEfficiency / _pParentScene.ODE_STEPSIZE;
801 809
802 if (Math.Abs(roll) > 0.01) // roll 810 if (Math.Abs(roll) > 0.01) // roll
803 { 811 {
804 torque.X -= roll * ftmp + curLocalAngVel.X * ftmp2; 812 torque.X -= -roll * ftmp + curLocalAngVel.X * ftmp2;
805 } 813 }
806 814
807 if (Math.Abs(pitch) > 0.01 && ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) == 0)) // pitch 815 if (Math.Abs(pitch) > 0.01 && ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) == 0)) // pitch
808 { 816 {
809 torque.Y -= pitch * ftmp + curLocalAngVel.Y * ftmp2; 817 torque.Y -= -pitch * ftmp + curLocalAngVel.Y * ftmp2;
810 } 818 }
811 819
812 if (m_bankingEfficiency != 0 && Math.Abs(roll) < 0.01) 820 if (m_bankingEfficiency != 0 && Math.Abs(roll) > 0.01)
813 { 821 {
814 float broll = -roll * m_bankingEfficiency; ; 822 float broll = roll * m_bankingEfficiency; ;
815 if (m_bankingMix != 0) 823 if (m_bankingMix != 0)
816 { 824 {
817 float vfact = m_bankingMix * Math.Abs(curLocalVel.X) / 10.0f; 825 float vfact = Math.Abs(curLocalVel.X) / 10.0f;
818 if (vfact < m_bankingMix) 826 if (vfact > 1.0f) vfact = 1.0f;
827 if (curLocalVel.X >= 0)
819 broll *= ((1 - m_bankingMix) + vfact); 828 broll *= ((1 - m_bankingMix) + vfact);
829 else
830 broll *= -((1 - m_bankingMix) + vfact);
820 } 831 }
821 832 broll = (broll - curLocalAngVel.Z) / m_bankingTimescale;
822 torque.Z += (broll - curLocalAngVel.Z) / m_bankingTimescale; 833 torque.Z += broll;
823 } 834 }
824 } 835 }
825 836