aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorKitto Flora2010-02-02 13:28:42 -0500
committerKitto Flora2010-02-02 13:28:42 -0500
commit8c2061029331e323b5c1c0414bbda417cb6c4674 (patch)
tree033080beaee89a2f3f27d29cd0582c75fef2ae69 /OpenSim/Region/Physics
parentSmall fix for a spurious exception (diff)
downloadopensim-SC_OLD-8c2061029331e323b5c1c0414bbda417cb6c4674.zip
opensim-SC_OLD-8c2061029331e323b5c1c0414bbda417cb6c4674.tar.gz
opensim-SC_OLD-8c2061029331e323b5c1c0414bbda417cb6c4674.tar.bz2
opensim-SC_OLD-8c2061029331e323b5c1c0414bbda417cb6c4674.tar.xz
AngMotor update 1
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs203
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs19
2 files changed, 143 insertions, 79 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs
index 14d5caa..c03e381 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs
@@ -108,13 +108,14 @@ namespace OpenSim.Region.Physics.OdePlugin
108 108
109 //Angular properties 109 //Angular properties
110 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor 110 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
111 private int m_angularMotorApply = 0; // application frame counter 111
112 private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity 112 private float m_angularMotorTimescale = 0; // motor angular Attack rate set by LSL
113 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate 113 private float m_angularMotorDecayTimescale = 0; // motor angular Decay rate set by LSL
114 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate 114 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular Friction set by LSL
115 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate 115
116 private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor
117// private Vector3 m_angObjectVel = Vector3.Zero; // current body angular velocity
116 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body 118 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
117 // private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
118 119
119 //Deflection properties 120 //Deflection properties
120 // private float m_angularDeflectionEfficiency = 0; 121 // private float m_angularDeflectionEfficiency = 0;
@@ -227,7 +228,7 @@ namespace OpenSim.Region.Physics.OdePlugin
227 break; 228 break;
228 case Vehicle.ANGULAR_MOTOR_DIRECTION: 229 case Vehicle.ANGULAR_MOTOR_DIRECTION:
229 m_angularMotorDirection = new Vector3(pValue, pValue, pValue); 230 m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
230 m_angularMotorApply = 10; 231 UpdateAngDecay();
231 break; 232 break;
232 case Vehicle.LINEAR_FRICTION_TIMESCALE: 233 case Vehicle.LINEAR_FRICTION_TIMESCALE:
233 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); 234 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
@@ -260,7 +261,7 @@ namespace OpenSim.Region.Physics.OdePlugin
260 if(m_angularMotorDirection.Y < - 12.56f) m_angularMotorDirection.Y = - 12.56f; 261 if(m_angularMotorDirection.Y < - 12.56f) m_angularMotorDirection.Y = - 12.56f;
261 if(m_angularMotorDirection.Z > 12.56f) m_angularMotorDirection.Z = 12.56f; 262 if(m_angularMotorDirection.Z > 12.56f) m_angularMotorDirection.Z = 12.56f;
262 if(m_angularMotorDirection.Z < - 12.56f) m_angularMotorDirection.Z = - 12.56f; 263 if(m_angularMotorDirection.Z < - 12.56f) m_angularMotorDirection.Z = - 12.56f;
263 m_angularMotorApply = 10; 264 UpdateAngDecay();
264 break; 265 break;
265 case Vehicle.LINEAR_FRICTION_TIMESCALE: 266 case Vehicle.LINEAR_FRICTION_TIMESCALE:
266 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); 267 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
@@ -310,6 +311,7 @@ namespace OpenSim.Region.Physics.OdePlugin
310 m_linearMotorTimescale = 1000; 311 m_linearMotorTimescale = 1000;
311 m_linearMotorDecayTimescale = 120; 312 m_linearMotorDecayTimescale = 120;
312 m_angularMotorDirection = Vector3.Zero; 313 m_angularMotorDirection = Vector3.Zero;
314 m_angularMotorDVel = Vector3.Zero;
313 m_angularMotorTimescale = 1000; 315 m_angularMotorTimescale = 1000;
314 m_angularMotorDecayTimescale = 120; 316 m_angularMotorDecayTimescale = 120;
315 m_VhoverHeight = 0; 317 m_VhoverHeight = 0;
@@ -336,6 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin
336 m_linearMotorTimescale = 1; 338 m_linearMotorTimescale = 1;
337 m_linearMotorDecayTimescale = 60; 339 m_linearMotorDecayTimescale = 60;
338 m_angularMotorDirection = Vector3.Zero; 340 m_angularMotorDirection = Vector3.Zero;
341 m_angularMotorDVel = Vector3.Zero;
339 m_angularMotorTimescale = 1; 342 m_angularMotorTimescale = 1;
340 m_angularMotorDecayTimescale = 0.8f; 343 m_angularMotorDecayTimescale = 0.8f;
341 m_VhoverHeight = 0; 344 m_VhoverHeight = 0;
@@ -363,6 +366,7 @@ namespace OpenSim.Region.Physics.OdePlugin
363 m_linearMotorTimescale = 5; 366 m_linearMotorTimescale = 5;
364 m_linearMotorDecayTimescale = 60; 367 m_linearMotorDecayTimescale = 60;
365 m_angularMotorDirection = Vector3.Zero; 368 m_angularMotorDirection = Vector3.Zero;
369 m_angularMotorDVel = Vector3.Zero;
366 m_angularMotorTimescale = 4; 370 m_angularMotorTimescale = 4;
367 m_angularMotorDecayTimescale = 4; 371 m_angularMotorDecayTimescale = 4;
368 m_VhoverHeight = 0; 372 m_VhoverHeight = 0;
@@ -391,6 +395,7 @@ namespace OpenSim.Region.Physics.OdePlugin
391 m_linearMotorTimescale = 2; 395 m_linearMotorTimescale = 2;
392 m_linearMotorDecayTimescale = 60; 396 m_linearMotorDecayTimescale = 60;
393 m_angularMotorDirection = Vector3.Zero; 397 m_angularMotorDirection = Vector3.Zero;
398 m_angularMotorDVel = Vector3.Zero;
394 m_angularMotorTimescale = 4; 399 m_angularMotorTimescale = 4;
395 m_angularMotorDecayTimescale = 4; 400 m_angularMotorDecayTimescale = 4;
396 m_VhoverHeight = 0; 401 m_VhoverHeight = 0;
@@ -417,6 +422,7 @@ namespace OpenSim.Region.Physics.OdePlugin
417 m_linearMotorTimescale = 5; 422 m_linearMotorTimescale = 5;
418 m_linearMotorDecayTimescale = 60; 423 m_linearMotorDecayTimescale = 60;
419 m_angularMotorDirection = Vector3.Zero; 424 m_angularMotorDirection = Vector3.Zero;
425 m_angularMotorDVel = Vector3.Zero;
420 m_angularMotorTimescale = 6; 426 m_angularMotorTimescale = 6;
421 m_angularMotorDecayTimescale = 10; 427 m_angularMotorDecayTimescale = 10;
422 m_VhoverHeight = 5; 428 m_VhoverHeight = 5;
@@ -468,8 +474,8 @@ namespace OpenSim.Region.Physics.OdePlugin
468 m_lLinObjectVel = Vector3.Zero; 474 m_lLinObjectVel = Vector3.Zero;
469 m_wLinObjectVel = Vector3.Zero; 475 m_wLinObjectVel = Vector3.Zero;
470 m_angularMotorDirection = Vector3.Zero; 476 m_angularMotorDirection = Vector3.Zero;
471 m_angularMotorVelocity = Vector3.Zero; 477 m_lastAngularVelocity = Vector3.Zero;
472 m_lastAngularVelocity = Vector3.Zero; 478 m_angularMotorDVel = Vector3.Zero;
473 } 479 }
474 480
475 private void UpdateLinDecay() 481 private void UpdateLinDecay()
@@ -611,54 +617,62 @@ namespace OpenSim.Region.Physics.OdePlugin
611 d.BodyAddForce(Body, grav.X, grav.Y, grav.Z); 617 d.BodyAddForce(Body, grav.X, grav.Y, grav.Z);
612//if(frcount == 0) Console.WriteLine("Grav {0}", grav); 618//if(frcount == 0) Console.WriteLine("Grav {0}", grav);
613 } // end MoveLinear() 619 } // end MoveLinear()
620
621 private void UpdateAngDecay()
622 {
623 if (Math.Abs(m_angularMotorDirection.X) > Math.Abs(m_angularMotorDVel.X)) m_angularMotorDVel.X = m_angularMotorDirection.X;
624 if (Math.Abs(m_angularMotorDirection.Y) > Math.Abs(m_angularMotorDVel.Y)) m_angularMotorDVel.Y = m_angularMotorDirection.Y;
625 if (Math.Abs(m_angularMotorDirection.Z) > Math.Abs(m_angularMotorDVel.Z)) m_angularMotorDVel.Z = m_angularMotorDirection.Z;
626 } // else let the motor decay on its own
614 627
615 private void MoveAngular(float pTimestep) 628 private void MoveAngular(float pTimestep)
616 { 629 {
617 /* 630 /*
618 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor 631 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
619 private int m_angularMotorApply = 0; // application frame counter 632
620 private float m_angularMotorVelocity = 0; // current angular motor velocity (ramps up and down) 633 private float m_angularMotorTimescale = 0; // motor angular Attack rate set by LSL
621 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate 634 private float m_angularMotorDecayTimescale = 0; // motor angular Decay rate set by LSL
622 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate 635 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular Friction set by LSL
623 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate 636
624 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body 637 private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor
638 private Vector3 m_angObjectVel = Vector3.Zero; // what was last applied to body
625 */ 639 */
626//if(frcount == 0) Console.WriteLine("MoveAngular "); 640//if(frcount == 0) Console.WriteLine("MoveAngular ");
627 641
642//####
628 // Get what the body is doing, this includes 'external' influences 643 // Get what the body is doing, this includes 'external' influences
629 d.Vector3 angularVelocity = d.BodyGetAngularVel(Body); 644 d.Vector3 angularObjectVel = d.BodyGetAngularVel(Body);
630 // Vector3 angularVelocity = Vector3.Zero; 645 Vector3 angObjectVel = new Vector3(angularObjectVel.X, angularObjectVel.Y, angularObjectVel.Z);
646//if(frcount == 0) Console.WriteLine("V0 = {0}", angObjectVel);
647// Vector3 FrAaccel = m_lastAngularVelocity - angObjectVel;
648// Vector3 initavel = angObjectVel;
649 // Decay Angular Motor
650 if (m_angularMotorDecayTimescale < 300.0f)
651 {
652 float decayfactor = m_angularMotorDecayTimescale/pTimestep;
653 Vector3 decayAmount = (m_angularMotorDVel/decayfactor);
654 m_angularMotorDVel -= decayAmount;
631 655
632 if (m_angularMotorApply > 0) 656 if (m_angularMotorDVel.ApproxEquals(Vector3.Zero, 0.01f))
633 { 657 {
634 // ramp up to new value 658 m_angularMotorDVel = Vector3.Zero;
635 // current velocity += error / ( time to get there / step interval ) 659 }
636 // requested speed - last motor speed 660 else
637 m_angularMotorVelocity.X += (m_angularMotorDirection.X - m_angularMotorVelocity.X) / (m_angularMotorTimescale / pTimestep); 661 {
638 m_angularMotorVelocity.Y += (m_angularMotorDirection.Y - m_angularMotorVelocity.Y) / (m_angularMotorTimescale / pTimestep); 662 if (Math.Abs(m_angularMotorDVel.X) < Math.Abs(angObjectVel.X)) angObjectVel.X = m_angularMotorDVel.X;
639 m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep); 663 if (Math.Abs(m_angularMotorDVel.Y) < Math.Abs(angObjectVel.Y)) angObjectVel.Y = m_angularMotorDVel.Y;
640 664 if (Math.Abs(m_angularMotorDVel.Z) < Math.Abs(angObjectVel.Z)) angObjectVel.Z = m_angularMotorDVel.Z;
641 m_angularMotorApply--; // This is done so that if script request rate is less than phys frame rate the expected 665 }
642 // velocity may still be acheived. 666 } // end decay angular motor
643 } 667//if(frcount == 0) Console.WriteLine("MotorDvel {0} Obj {1}", m_angularMotorDVel, angObjectVel);
644 else
645 {
646 // no motor recently applied, keep the body velocity
647 /* m_angularMotorVelocity.X = angularVelocity.X;
648 m_angularMotorVelocity.Y = angularVelocity.Y;
649 m_angularMotorVelocity.Z = angularVelocity.Z; */
650
651 // and decay the velocity
652 m_angularMotorVelocity -= m_angularMotorVelocity / (m_angularMotorDecayTimescale / pTimestep);
653 } // end motor section
654
655 668
669//if(frcount == 0) Console.WriteLine("VA = {0}", angObjectVel);
656 // Vertical attractor section 670 // Vertical attractor section
657 Vector3 vertattr = Vector3.Zero; 671 Vector3 vertattr = Vector3.Zero;
658 672
659 if(m_verticalAttractionTimescale < 300) 673 if(m_verticalAttractionTimescale < 300)
660 { 674 {
661 float VAservo = 0.0167f / (m_verticalAttractionTimescale * pTimestep); 675 float VAservo = 1.0f / (m_verticalAttractionTimescale * pTimestep);
662 // get present body rotation 676 // get present body rotation
663 d.Quaternion rot = d.BodyGetQuaternion(Body); 677 d.Quaternion rot = d.BodyGetQuaternion(Body);
664 Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); 678 Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W);
@@ -670,38 +684,88 @@ namespace OpenSim.Region.Physics.OdePlugin
670 // verterr.X and .Y are the World error ammounts. They are 0 when there is no error (Vehicle Body is 'vertical'), and .Z will be 1. 684 // verterr.X and .Y are the World error ammounts. They are 0 when there is no error (Vehicle Body is 'vertical'), and .Z will be 1.
671 // As the body leans to its side |.X| will increase to 1 and .Z fall to 0. As body inverts |.X| will fall and .Z will go 685 // As the body leans to its side |.X| will increase to 1 and .Z fall to 0. As body inverts |.X| will fall and .Z will go
672 // negative. Similar for tilt and |.Y|. .X and .Y must be modulated to prevent a stable inverted body. 686 // negative. Similar for tilt and |.Y|. .X and .Y must be modulated to prevent a stable inverted body.
687
673 if (verterr.Z < 0.0f) 688 if (verterr.Z < 0.0f)
674 { 689 { // Defelction from vertical exceeds 90-degrees. This method will ensure stable return to
690 // vertical, BUT for some reason a z-rotation is imparted to the object. TBI.
691//Console.WriteLine("InvertFlip");
675 verterr.X = 2.0f - verterr.X; 692 verterr.X = 2.0f - verterr.X;
676 verterr.Y = 2.0f - verterr.Y; 693 verterr.Y = 2.0f - verterr.Y;
677 } 694 }
678 // Error is 0 (no error) to +/- 2 (max error) 695 verterr *= 0.5f;
679 // scale it by VAservo 696 // verterror is 0 (no error) to +/- 1 (max error at 180-deg tilt)
680 verterr = verterr * VAservo; 697
698 if ((!angObjectVel.ApproxEquals(Vector3.Zero, 0.001f)) || (verterr.Z < 0.49f))
699 {
700//if(frcount == 0)
701 // As the body rotates around the X axis, then verterr.Y increases; Rotated around Y then .X increases, so
702 // Change Body angular velocity X based on Y, and Y based on X. Z is not changed.
703 vertattr.X = verterr.Y;
704 vertattr.Y = - verterr.X;
705 vertattr.Z = 0f;
681//if(frcount == 0) Console.WriteLine("VAerr=" + verterr); 706//if(frcount == 0) Console.WriteLine("VAerr=" + verterr);
682 707
683 // As the body rotates around the X axis, then verterr.Y increases; Rotated around Y then .X increases, so 708 // scaling appears better usingsquare-law
684 // Change Body angular velocity X based on Y, and Y based on X. Z is not changed. 709 float damped = m_verticalAttractionEfficiency * m_verticalAttractionEfficiency;
685 vertattr.X = verterr.Y; 710 float bounce = 1.0f - damped;
686 vertattr.Y = - verterr.X; 711 // 0 = crit damp, 1 = bouncy
687 vertattr.Z = 0f; 712 float oavz = angObjectVel.Z; // retain z velocity
688 713 angObjectVel = (angObjectVel + (vertattr * VAservo * 0.0333f)) * bounce; // The time-scaled correction, which sums, therefore is bouncy
689 // scaling appears better usingsquare-law 714 angObjectVel = angObjectVel + (vertattr * VAservo * 0.0667f * damped); // damped, good @ < 90.
690 float bounce = 1.0f - (m_verticalAttractionEfficiency * m_verticalAttractionEfficiency); 715 angObjectVel.Z = oavz;
691 vertattr.X += bounce * angularVelocity.X; 716//if(frcount == 0) Console.WriteLine("VA+");
692 vertattr.Y += bounce * angularVelocity.Y; 717//Console.WriteLine("VAttr {0} OAvel {1}", vertattr, angObjectVel);
693 718 }
719 else
720 {
721 // else error is very small
722 angObjectVel.X = 0f;
723 angObjectVel.Y = 0f;
724//if(frcount == 0) Console.WriteLine("VA0");
725 }
694 } // else vertical attractor is off 726 } // else vertical attractor is off
727//if(frcount == 0) Console.WriteLine("V1 = {0}", angObjectVel);
728
729 if ( (! m_angularMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) || (! angObjectVel.ApproxEquals(Vector3.Zero, 0.01f)) )
730 { // if motor or object have motion
731 if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body);
732
733 if (m_angularMotorTimescale < 300.0f)
734 {
735 Vector3 attack_error = m_angularMotorDVel - angObjectVel;
736 float angfactor = m_angularMotorTimescale/pTimestep;
737 Vector3 attackAmount = (attack_error/angfactor);
738 angObjectVel += attackAmount;
739//if(frcount == 0) Console.WriteLine("Accel {0} Attk {1}",FrAaccel, attackAmount);
740//if(frcount == 0) Console.WriteLine("V2+= {0}", angObjectVel);
741 }
742
743 if (m_angularFrictionTimescale.X < 300.0f)
744 {
745 float fricfactor = m_angularFrictionTimescale.X / pTimestep;
746 angObjectVel.X -= angObjectVel.X / fricfactor;
747 }
748 if (m_angularFrictionTimescale.Y < 300.0f)
749 {
750 float fricfactor = m_angularFrictionTimescale.Y / pTimestep;
751 angObjectVel.Y -= angObjectVel.Y / fricfactor;
752 }
753 if (m_angularFrictionTimescale.Z < 300.0f)
754 {
755 float fricfactor = m_angularFrictionTimescale.Z / pTimestep;
756 angObjectVel.Z -= angObjectVel.Z / fricfactor;
757 Console.WriteLine("z fric");
758 }
759 } // else no signif. motion
695 760
696 // m_lastVertAttractor = vertattr; 761//if(frcount == 0) Console.WriteLine("Dmotor {0} Obj {1}", m_angularMotorDVel, angObjectVel);
697
698 // Bank section tba 762 // Bank section tba
699 // Deflection section tba 763 // Deflection section tba
764//if(frcount == 0) Console.WriteLine("V3 = {0}", angObjectVel);
700 765
701 // Sum velocities 766 m_lastAngularVelocity = angObjectVel;
702 m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // tba: + bank + deflection 767/*
703 768 if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.0001f))
704 if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
705 { 769 {
706 if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); 770 if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body);
707 } 771 }
@@ -709,13 +773,12 @@ namespace OpenSim.Region.Physics.OdePlugin
709 { 773 {
710 m_lastAngularVelocity = Vector3.Zero; // Reduce small value to zero. 774 m_lastAngularVelocity = Vector3.Zero; // Reduce small value to zero.
711 } 775 }
712 776 */
713 // apply friction
714 Vector3 decayamount = Vector3.One / (m_angularFrictionTimescale / pTimestep);
715 m_lastAngularVelocity -= m_lastAngularVelocity * decayamount;
716
717 // Apply to the body 777 // Apply to the body
778// Vector3 aInc = m_lastAngularVelocity - initavel;
779//if(frcount == 0) Console.WriteLine("Inc {0}", aInc);
718 d.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z); 780 d.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z);
781//if(frcount == 0) Console.WriteLine("V4 = {0}", m_lastAngularVelocity);
719 782
720 } //end MoveAngular 783 } //end MoveAngular
721 } 784 }
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index 29a3dd9..8502aef 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -2593,14 +2593,14 @@ Console.WriteLine(" JointCreateFixed");
2593 { 2593 {
2594 get 2594 get
2595 { 2595 {
2596 Vector3 pv = Vector3.Zero; 2596/* Vector3 pv = Vector3.Zero;
2597 if (_zeroFlag) 2597 if (_zeroFlag)
2598 return pv; 2598 return pv;
2599 m_lastUpdateSent = false; 2599 m_lastUpdateSent = false;
2600 2600
2601 if (m_rotationalVelocity.ApproxEquals(pv, 0.2f)) 2601 if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
2602 return pv; 2602 return pv;
2603 2603*/
2604 return m_rotationalVelocity; 2604 return m_rotationalVelocity;
2605 } 2605 }
2606 set 2606 set
@@ -2827,14 +2827,15 @@ Console.WriteLine(" JointCreateFixed");
2827 _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); 2827 _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
2828 //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); 2828 //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
2829 2829
2830 if (_velocity.ApproxEquals(pv, 0.5f)) 2830// if (_velocity.ApproxEquals(pv, 0.5f)) ???? Disregard rotational vel if lin vel is < 0.5 ?????
2831 { 2831// {
2832 m_rotationalVelocity = pv; 2832// m_rotationalVelocity = pv;/
2833 } 2833
2834 else 2834// }
2835 { 2835// else
2836// {
2836 m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z); 2837 m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z);
2837 } 2838// }
2838 2839
2839 //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); 2840 //m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
2840 _orientation.X = ori.X; 2841 _orientation.X = ori.X;