aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/ChOdePlugin
diff options
context:
space:
mode:
authorKitto Flora2010-03-12 16:13:52 -0500
committerKitto Flora2010-03-12 16:13:52 -0500
commit1379ae4310b94afd1a7a1d9964db26146ca5c7b2 (patch)
treef2767574095b9e96d6c28ba93249d7b4ac0d67bc /OpenSim/Region/Physics/ChOdePlugin
parentResolved merge (diff)
downloadopensim-SC_OLD-1379ae4310b94afd1a7a1d9964db26146ca5c7b2.zip
opensim-SC_OLD-1379ae4310b94afd1a7a1d9964db26146ca5c7b2.tar.gz
opensim-SC_OLD-1379ae4310b94afd1a7a1d9964db26146ca5c7b2.tar.bz2
opensim-SC_OLD-1379ae4310b94afd1a7a1d9964db26146ca5c7b2.tar.xz
Fix Rotation Lock. NOTE: This version had poor border crossing control
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs38
1 files changed, 18 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index e51ef5b..367927d 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Physics.OdePlugin
64 private Vector3 m_taintVelocity; 64 private Vector3 m_taintVelocity;
65 private Vector3 m_taintTorque; 65 private Vector3 m_taintTorque;
66 private Quaternion m_taintrot; 66 private Quaternion m_taintrot;
67 private Vector3 m_angularlock = Vector3.One; // Current setting 67 private Vector3 m_angularEnable = Vector3.One; // Current setting
68 private Vector3 m_taintAngularLock = Vector3.One; // Request from LSL 68 private Vector3 m_taintAngularLock = Vector3.One; // Request from LSL
69 69
70 70
@@ -216,8 +216,6 @@ namespace OpenSim.Region.Physics.OdePlugin
216 private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor 216 private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor
217// private Vector3 m_angObjectVel = Vector3.Zero; // current body angular velocity 217// private Vector3 m_angObjectVel = Vector3.Zero; // current body angular velocity
218 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body 218 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
219
220 private Vector3 m_angularLock = Vector3.One;
221 219
222 //Deflection properties 220 //Deflection properties
223 // private float m_angularDeflectionEfficiency = 0; 221 // private float m_angularDeflectionEfficiency = 0;
@@ -1401,8 +1399,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1401 changefloatonwater(timestep); 1399 changefloatonwater(timestep);
1402 1400
1403 // ##* 1401 // ##*
1404 if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) 1402 if (!m_angularEnable.ApproxEquals(m_taintAngularLock,0f))
1405//Console.WriteLine("ALchange req {0} is {1}", m_taintAngularLock, m_angularlock); 1403Console.WriteLine("ALchange req {0} is {1}", m_taintAngularLock, m_angularEnable);
1406 changeAngularLock(timestep); 1404 changeAngularLock(timestep);
1407 1405
1408 } 1406 }
@@ -1422,8 +1420,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1422 //If we have a parent then we're not authorative here 1420 //If we have a parent then we're not authorative here
1423 if (_parent == null) 1421 if (_parent == null)
1424 { 1422 {
1425//Console.WriteLine("Alock changed to {0}", m_taintAngularLock); 1423Console.WriteLine("Alock changed to {0}", m_taintAngularLock);
1426 m_angularlock = m_taintAngularLock; 1424 m_angularEnable = m_taintAngularLock;
1427 } 1425 }
1428 } 1426 }
1429 1427
@@ -3703,15 +3701,15 @@ Console.WriteLine(" JointCreateFixed");
3703//if(frcount == 0) Console.WriteLine("V3 = {0}", angObjectVel); 3701//if(frcount == 0) Console.WriteLine("V3 = {0}", angObjectVel);
3704 3702
3705 m_lastAngularVelocity = angObjectVel; 3703 m_lastAngularVelocity = angObjectVel;
3706//if(frcount == 0) Console.WriteLine("angularLock {0}", m_angularLock); 3704if(frcount == 0) Console.WriteLine("angularEnable {0}", m_angularEnable);
3707 3705
3708 if (!m_angularLock.ApproxEquals(Vector3.One, 0.003f)) 3706 if (!m_angularEnable.ApproxEquals(Vector3.One, 0.003f))
3709 { 3707 {
3710 if (m_angularLock.X == 0) 3708 if (m_angularEnable.X == 0)
3711 m_lastAngularVelocity.X = 0f; 3709 m_lastAngularVelocity.X = 0f;
3712 if (m_angularLock.Y == 0) 3710 if (m_angularEnable.Y == 0)
3713 m_lastAngularVelocity.Y = 0f; 3711 m_lastAngularVelocity.Y = 0f;
3714 if (m_angularLock.Z == 0) 3712 if (m_angularEnable.Z == 0)
3715 m_lastAngularVelocity.Z = 0f; 3713 m_lastAngularVelocity.Z = 0f;
3716 } 3714 }
3717 // Apply to the body 3715 // Apply to the body
@@ -3727,18 +3725,18 @@ Console.WriteLine(" JointCreateFixed");
3727 { 3725 {
3728 if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 3726 if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
3729 // NON-'VEHICLES' are dealt with here 3727 // NON-'VEHICLES' are dealt with here
3730 // m_angularlock = <1,1,1> means no lock. a 0 on axis means locked. 3728 // m_angularEnable = <1,1,1> means no lock. a 0 on axis means locked.
3731 3729
3732// NB this may be wrong - may lock global axis! Should be LOCAL axis! 3730// NB this may be wrong - may lock global axis! Should be LOCAL axis!
3733 /// Dynamics Angular Lock ======================================================================== 3731 /// Dynamics Angular Lock ========================================================================
3734 if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.One, 0.003f)) 3732 if (d.BodyIsEnabled(Body) && !m_angularEnable.ApproxEquals(Vector3.One, 0.003f))
3735 { 3733 {
3736 d.Vector3 avel2 = d.BodyGetAngularVel(Body); 3734 d.Vector3 avel2 = d.BodyGetAngularVel(Body);
3737 if (m_angularlock.X == 0) 3735 if (m_angularEnable.X == 0)
3738 avel2.X = 0; 3736 avel2.X = 0;
3739 if (m_angularlock.Y == 0) 3737 if (m_angularEnable.Y == 0)
3740 avel2.Y = 0; 3738 avel2.Y = 0;
3741 if (m_angularlock.Z == 0) 3739 if (m_angularEnable.Z == 0)
3742 avel2.Z = 0; 3740 avel2.Z = 0;
3743 d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); 3741 d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z);
3744 } 3742 }
@@ -3938,11 +3936,11 @@ Console.WriteLine(" JointCreateFixed");
3938 RLAservo = timestep / m_APIDStrength * scaler; 3936 RLAservo = timestep / m_APIDStrength * scaler;
3939 rotforce = rotforce * RLAservo * diff_angle ; 3937 rotforce = rotforce * RLAservo * diff_angle ;
3940 3938
3941 if (m_angularlock.X == 0) 3939 if (m_angularEnable.X == 0)
3942 rotforce.X = 0; 3940 rotforce.X = 0;
3943 if (m_angularlock.Y == 0) 3941 if (m_angularEnable.Y == 0)
3944 rotforce.Y = 0; 3942 rotforce.Y = 0;
3945 if (m_angularlock.Z == 0) 3943 if (m_angularEnable.Z == 0)
3946 rotforce.Z = 0; 3944 rotforce.Z = 0;
3947 3945
3948 d.BodySetAngularVel (Body, rotforce.X, rotforce.Y, rotforce.Z); 3946 d.BodySetAngularVel (Body, rotforce.X, rotforce.Y, rotforce.Z);