aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs52
1 files changed, 28 insertions, 24 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index faa9488..7cabddd 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -25,7 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* Revision 2011/12 by Ubit Umarov 28/* Revision 2011/12/13 by Ubit Umarov
29 * 29 *
30 * 30 *
31 */ 31 */
@@ -1736,7 +1736,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1736 1736
1737 d.BodySetAutoDisableFlag(Body, true); 1737 d.BodySetAutoDisableFlag(Body, true);
1738 d.BodySetAutoDisableSteps(Body, body_autodisable_frames); 1738 d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
1739 d.BodySetDamping(Body, .005f, .005f); 1739 d.BodySetAutoDisableAngularThreshold(Body, 0.01f);
1740 d.BodySetAutoDisableLinearThreshold(Body, 0.01f);
1741 d.BodySetDamping(Body, .005f, .001f);
1740 1742
1741 if (m_targetSpace != IntPtr.Zero) 1743 if (m_targetSpace != IntPtr.Zero)
1742 { 1744 {
@@ -2144,7 +2146,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2144 2146
2145 _mass = primMass; // just in case 2147 _mass = primMass; // just in case
2146 2148
2147 d.MassSetBoxTotal(out primdMass, primMass, m_OBB.X, m_OBB.Y, m_OBB.Z); 2149 d.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z);
2148 2150
2149 d.MassTranslate(ref primdMass, 2151 d.MassTranslate(ref primdMass,
2150 m_OBBOffset.X, 2152 m_OBBOffset.X,
@@ -2362,6 +2364,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2362 MakeBody(); 2364 MakeBody();
2363 } 2365 }
2364 2366
2367
2365 #region changes 2368 #region changes
2366 2369
2367 private void changeadd() 2370 private void changeadd()
@@ -3213,7 +3216,6 @@ namespace OpenSim.Region.Physics.OdePlugin
3213 3216
3214 if (++bodydisablecontrol < 20) 3217 if (++bodydisablecontrol < 20)
3215 return; 3218 return;
3216
3217 3219
3218 d.BodyEnable(Body); 3220 d.BodyEnable(Body);
3219 } 3221 }
@@ -3381,11 +3383,12 @@ namespace OpenSim.Region.Physics.OdePlugin
3381 } 3383 }
3382 } 3384 }
3383 3385
3384 public void UpdatePositionAndVelocity() 3386 public void UpdatePositionAndVelocity(int frame)
3385 { 3387 {
3386 if (_parent == null && !m_disabled && !m_building && !m_outbounds && Body != IntPtr.Zero) 3388 if (_parent == null && !m_disabled && !m_building && !m_outbounds && Body != IntPtr.Zero)
3387 { 3389 {
3388 if (d.BodyIsEnabled(Body) || !_zeroFlag) 3390 bool bodyenabled = d.BodyIsEnabled(Body);
3391 if (bodyenabled || !_zeroFlag)
3389 { 3392 {
3390 bool lastZeroFlag = _zeroFlag; 3393 bool lastZeroFlag = _zeroFlag;
3391 3394
@@ -3478,13 +3481,13 @@ namespace OpenSim.Region.Physics.OdePlugin
3478 // tolerance values depende a lot on simulation noise... 3481 // tolerance values depende a lot on simulation noise...
3479 // use simple math.abs since we dont need to be exact 3482 // use simple math.abs since we dont need to be exact
3480 3483
3481 if ( 3484 if (!bodyenabled ||
3482 (Math.Abs(_position.X - lpos.X) < 0.001f) 3485 (Math.Abs(_position.X - lpos.X) < 0.005f)
3483 && (Math.Abs(_position.Y - lpos.Y) < 0.001f) 3486 && (Math.Abs(_position.Y - lpos.Y) < 0.005f)
3484 && (Math.Abs(_position.Z - lpos.Z) < 0.001f) 3487 && (Math.Abs(_position.Z - lpos.Z) < 0.005f)
3485 && (Math.Abs(_orientation.X - ori.X) < 0.0001f) 3488 && (Math.Abs(_orientation.X - ori.X) < 0.001f)
3486 && (Math.Abs(_orientation.Y - ori.Y) < 0.0001f) 3489 && (Math.Abs(_orientation.Y - ori.Y) < 0.001f)
3487 && (Math.Abs(_orientation.Z - ori.Z) < 0.0001f) // ignore W 3490 && (Math.Abs(_orientation.Z - ori.Z) < 0.001f) // ignore W
3488 ) 3491 )
3489 { 3492 {
3490 _zeroFlag = true; 3493 _zeroFlag = true;
@@ -3499,9 +3502,9 @@ namespace OpenSim.Region.Physics.OdePlugin
3499 3502
3500 _acceleration = _velocity; 3503 _acceleration = _velocity;
3501 3504
3502 if ((Math.Abs(vel.X) < 0.001f) && 3505 if ((Math.Abs(vel.X) < 0.005f) &&
3503 (Math.Abs(vel.Y) < 0.001f) && 3506 (Math.Abs(vel.Y) < 0.005f) &&
3504 (Math.Abs(vel.Z) < 0.001f)) 3507 (Math.Abs(vel.Z) < 0.005f))
3505 { 3508 {
3506 _velocity = Vector3.Zero; 3509 _velocity = Vector3.Zero;
3507 float t = -m_invTimeStep; 3510 float t = -m_invTimeStep;
@@ -3538,6 +3541,15 @@ namespace OpenSim.Region.Physics.OdePlugin
3538 } 3541 }
3539 } 3542 }
3540 3543
3544 _position.X = lpos.X;
3545 _position.Y = lpos.Y;
3546 _position.Z = lpos.Z;
3547
3548 _orientation.X = ori.X;
3549 _orientation.Y = ori.Y;
3550 _orientation.Z = ori.Z;
3551 _orientation.W = ori.W;
3552
3541 if (_zeroFlag) 3553 if (_zeroFlag)
3542 { 3554 {
3543 if (lastZeroFlag) 3555 if (lastZeroFlag)
@@ -3556,14 +3568,6 @@ namespace OpenSim.Region.Physics.OdePlugin
3556 return; 3568 return;
3557 } 3569 }
3558 3570
3559 _position.X = lpos.X;
3560 _position.Y = lpos.Y;
3561 _position.Z = lpos.Z;
3562
3563 _orientation.X = ori.X;
3564 _orientation.Y = ori.Y;
3565 _orientation.Z = ori.Z;
3566 _orientation.W = ori.W;
3567 base.RequestPhysicsterseUpdate(); 3571 base.RequestPhysicsterseUpdate();
3568 m_lastUpdateSent = false; 3572 m_lastUpdateSent = false;
3569 } 3573 }