aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs225
1 files changed, 98 insertions, 127 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 8169e99..61006f0 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
80 // Linear properties 80 // Linear properties
81 private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time 81 private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time
82 private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL 82 private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL
83 private Vector3 m_dir = Vector3.Zero; // velocity applied to body 83 private Vector3 m_newVelocity = Vector3.Zero; // velocity computed to be applied to body
84 private Vector3 m_linearFrictionTimescale = Vector3.Zero; 84 private Vector3 m_linearFrictionTimescale = Vector3.Zero;
85 private float m_linearMotorDecayTimescale = 0; 85 private float m_linearMotorDecayTimescale = 0;
86 private float m_linearMotorTimescale = 0; 86 private float m_linearMotorTimescale = 0;
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
131 m_type = Vehicle.TYPE_NONE; 131 m_type = Vehicle.TYPE_NONE;
132 } 132 }
133 133
134 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue, float timestep) 134 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
135 { 135 {
136 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue); 136 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
137 switch (pParam) 137 switch (pParam)
@@ -230,7 +230,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
230 } 230 }
231 }//end ProcessFloatVehicleParam 231 }//end ProcessFloatVehicleParam
232 232
233 internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue, float timestep) 233 internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
234 { 234 {
235 VDetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue); 235 VDetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
236 switch (pParam) 236 switch (pParam)
@@ -299,7 +299,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
299 } 299 }
300 }//end ProcessVehicleFlags 300 }//end ProcessVehicleFlags
301 301
302 internal void ProcessTypeChange(Vehicle pType, float stepSize) 302 internal void ProcessTypeChange(Vehicle pType)
303 { 303 {
304 VDetailLog("{0},ProcessTypeChange,type={1}", m_prim.LocalID, pType); 304 VDetailLog("{0},ProcessTypeChange,type={1}", m_prim.LocalID, pType);
305 // Set Defaults For Type 305 // Set Defaults For Type
@@ -478,29 +478,30 @@ namespace OpenSim.Region.Physics.BulletSPlugin
478 MoveAngular(pTimestep); 478 MoveAngular(pTimestep);
479 LimitRotation(pTimestep); 479 LimitRotation(pTimestep);
480 480
481 // remember the position so next step we can limit absolute movement effects
482 m_lastPositionVector = m_prim.Position;
483
481 VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}", 484 VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}",
482 m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity); 485 m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity);
483 }// end Step 486 }// end Step
484 487
485 private void MoveLinear(float pTimestep) 488 private void MoveLinear(float pTimestep)
486 { 489 {
487 // requested m_linearMotorDirection is significant 490 // m_linearMotorDirection is the direction we are moving relative to the vehicle coordinates
488 // if (!m_linearMotorDirection.ApproxEquals(Vector3.Zero, 0.01f)) 491 // m_lastLinearVelocityVector is the speed we are moving in that direction
489 if (m_linearMotorDirection.LengthSquared() > 0.0001f) 492 if (m_linearMotorDirection.LengthSquared() > 0.001f)
490 { 493 {
491 Vector3 origDir = m_linearMotorDirection; 494 Vector3 origDir = m_linearMotorDirection;
492 Vector3 origVel = m_lastLinearVelocityVector; 495 Vector3 origVel = m_lastLinearVelocityVector;
493 496
494 // add drive to body 497 // add drive to body
495 // Vector3 addAmount = m_linearMotorDirection/(m_linearMotorTimescale/pTimestep); 498 // Vector3 addAmount = m_linearMotorDirection/(m_linearMotorTimescale / pTimestep);
496 Vector3 addAmount = m_linearMotorDirection/(m_linearMotorTimescale); 499 Vector3 addAmount = (m_linearMotorDirection - m_lastLinearVelocityVector)/(m_linearMotorTimescale / pTimestep);
497 // lastLinearVelocityVector is the current body velocity vector? 500 // lastLinearVelocityVector is the current body velocity vector
498 // RA: Not sure what the *10 is for. A correction for pTimestep? 501 // RA: Not sure what the *10 is for. A correction for pTimestep?
499 // m_lastLinearVelocityVector += (addAmount*10); 502 // m_lastLinearVelocityVector += (addAmount*10);
500 m_lastLinearVelocityVector += addAmount; 503 m_lastLinearVelocityVector += addAmount;
501 504
502 // This will work temporarily, but we really need to compare speed on an axis
503 // KF: Limit body velocity to applied velocity?
504 // Limit the velocity vector to less than the last set linear motor direction 505 // Limit the velocity vector to less than the last set linear motor direction
505 if (Math.Abs(m_lastLinearVelocityVector.X) > Math.Abs(m_linearMotorDirectionLASTSET.X)) 506 if (Math.Abs(m_lastLinearVelocityVector.X) > Math.Abs(m_linearMotorDirectionLASTSET.X))
506 m_lastLinearVelocityVector.X = m_linearMotorDirectionLASTSET.X; 507 m_lastLinearVelocityVector.X = m_linearMotorDirectionLASTSET.X;
@@ -509,95 +510,58 @@ namespace OpenSim.Region.Physics.BulletSPlugin
509 if (Math.Abs(m_lastLinearVelocityVector.Z) > Math.Abs(m_linearMotorDirectionLASTSET.Z)) 510 if (Math.Abs(m_lastLinearVelocityVector.Z) > Math.Abs(m_linearMotorDirectionLASTSET.Z))
510 m_lastLinearVelocityVector.Z = m_linearMotorDirectionLASTSET.Z; 511 m_lastLinearVelocityVector.Z = m_linearMotorDirectionLASTSET.Z;
511 512
513 /*
512 // decay applied velocity 514 // decay applied velocity
513 Vector3 decayfraction = ((Vector3.One/(m_linearMotorDecayTimescale/pTimestep))); 515 Vector3 decayfraction = Vector3.One/(m_linearMotorDecayTimescale / pTimestep);
516 // (RA: do not know where the 0.5f comes from)
514 m_linearMotorDirection -= m_linearMotorDirection * decayfraction * 0.5f; 517 m_linearMotorDirection -= m_linearMotorDirection * decayfraction * 0.5f;
515
516 /*
517 Vector3 addAmount = (m_linearMotorDirection - m_lastLinearVelocityVector)/m_linearMotorTimescale;
518 m_lastLinearVelocityVector += addAmount;
519
520 float decayfraction = (1.0f - 1.0f / m_linearMotorDecayTimescale);
521 m_linearMotorDirection *= decayfraction;
522
523 */ 518 */
519 float keepfraction = 1.0f - (1.0f / (m_linearMotorDecayTimescale / pTimestep));
520 m_linearMotorDirection *= keepfraction;
524 521
525 VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},decay={4},dir={5},vel={6}", 522 VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},notDecay={4},dir={5},vel={6}",
526 m_prim.LocalID, origDir, origVel, addAmount, decayfraction, m_linearMotorDirection, m_lastLinearVelocityVector); 523 m_prim.LocalID, origDir, origVel, addAmount, keepfraction, m_linearMotorDirection, m_lastLinearVelocityVector);
527 } 524 }
528 else 525 else
529 { 526 {
530 // if what remains of applied is small, zero it. 527 // if what remains of direction is very small, zero it.
531 // if (m_lastLinearVelocityVector.ApproxEquals(Vector3.Zero, 0.01f))
532 // m_lastLinearVelocityVector = Vector3.Zero;
533 m_linearMotorDirection = Vector3.Zero; 528 m_linearMotorDirection = Vector3.Zero;
534 m_lastLinearVelocityVector = Vector3.Zero; 529 m_lastLinearVelocityVector = Vector3.Zero;
530 VDetailLog("{0},MoveLinear,zeroed", m_prim.LocalID);
535 } 531 }
536 532
537 // convert requested object velocity to object relative vector 533 // convert requested object velocity to object relative vector
538 Quaternion rotq = m_prim.Orientation; 534 Quaternion rotq = m_prim.Orientation;
539 m_dir = m_lastLinearVelocityVector * rotq; 535 m_newVelocity = m_lastLinearVelocityVector * rotq;
540 536
541 // Add the various forces into m_dir which will be our new direction vector (velocity) 537 // Add the various forces into m_dir which will be our new direction vector (velocity)
542 538
543 // add Gravity and Buoyancy 539 // add Gravity and Buoyancy
544 // KF: So far I have found no good method to combine a script-requested
545 // .Z velocity and gravity. Therefore only 0g will used script-requested
546 // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only.
547 Vector3 grav = Vector3.Zero;
548 // There is some gravity, make a gravity force vector that is applied after object velocity. 540 // There is some gravity, make a gravity force vector that is applied after object velocity.
549 // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g; 541 // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
550 grav.Z = m_prim.Scene.DefaultGravity.Z * m_prim.Mass * (1f - m_VehicleBuoyancy); 542 Vector3 grav = m_prim.Scene.DefaultGravity * (m_prim.Mass * (1f - m_VehicleBuoyancy));
543
544 /*
545 * RA: Not sure why one would do this
551 // Preserve the current Z velocity 546 // Preserve the current Z velocity
552 Vector3 vel_now = m_prim.Velocity; 547 Vector3 vel_now = m_prim.Velocity;
553 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity 548 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
549 */
554 550
555 Vector3 pos = m_prim.Position; 551 Vector3 pos = m_prim.Position;
556 Vector3 posChange = pos;
557// Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); 552// Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f);
558 double Zchange = Math.Abs(posChange.Z);
559 if (m_BlockingEndPoint != Vector3.Zero)
560 {
561 bool changed = false;
562 if (pos.X >= (m_BlockingEndPoint.X - (float)1))
563 {
564 pos.X -= posChange.X + 1;
565 changed = true;
566 }
567 if (pos.Y >= (m_BlockingEndPoint.Y - (float)1))
568 {
569 pos.Y -= posChange.Y + 1;
570 changed = true;
571 }
572 if (pos.Z >= (m_BlockingEndPoint.Z - (float)1))
573 {
574 pos.Z -= posChange.Z + 1;
575 changed = true;
576 }
577 if (pos.X <= 0)
578 {
579 pos.X += posChange.X + 1;
580 changed = true;
581 }
582 if (pos.Y <= 0)
583 {
584 pos.Y += posChange.Y + 1;
585 changed = true;
586 }
587 if (changed)
588 {
589 m_prim.Position = pos;
590 VDetailLog("{0},MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}",
591 m_prim.LocalID, m_BlockingEndPoint, posChange, pos);
592 }
593 }
594 553
595 // If below the terrain, move us above the ground a little. 554 // If below the terrain, move us above the ground a little.
596 if (pos.Z < m_prim.Scene.TerrainManager.GetTerrainHeightAtXYZ(pos)) 555 float terrainHeight = m_prim.Scene.TerrainManager.GetTerrainHeightAtXYZ(pos);
556 // Taking the rotated size doesn't work here because m_prim.Size is the size of the root prim and not the linkset.
557 // Need to add a m_prim.LinkSet.Size similar to m_prim.LinkSet.Mass.
558 // Vector3 rotatedSize = m_prim.Size * m_prim.Orientation;
559 // if (rotatedSize.Z < terrainHeight)
560 if (pos.Z < terrainHeight)
597 { 561 {
598 pos.Z = m_prim.Scene.TerrainManager.GetTerrainHeightAtXYZ(pos) + 2; 562 pos.Z = terrainHeight + 2;
599 m_prim.Position = pos; 563 m_prim.Position = pos;
600 VDetailLog("{0},MoveLinear,terrainHeight,pos={1}", m_prim.LocalID, pos); 564 VDetailLog("{0},MoveLinear,terrainHeight,terrainHeight={1},pos={2}", m_prim.LocalID, terrainHeight, pos);
601 } 565 }
602 566
603 // Check if hovering 567 // Check if hovering
@@ -606,11 +570,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
606 // We should hover, get the target height 570 // We should hover, get the target height
607 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0) 571 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0)
608 { 572 {
609 m_VhoverTargetHeight = m_prim.Scene.GetWaterLevel() + m_VhoverHeight; 573 m_VhoverTargetHeight = m_prim.Scene.GetWaterLevelAtXYZ(pos) + m_VhoverHeight;
610 } 574 }
611 if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0) 575 if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
612 { 576 {
613 m_VhoverTargetHeight = m_prim.Scene.TerrainManager.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight; 577 m_VhoverTargetHeight = terrainHeight + m_VhoverHeight;
614 } 578 }
615 if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0) 579 if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0)
616 { 580 {
@@ -635,82 +599,92 @@ namespace OpenSim.Region.Physics.BulletSPlugin
635 // Replace Vertical speed with correction figure if significant 599 // Replace Vertical speed with correction figure if significant
636 if (Math.Abs(herr0) > 0.01f) 600 if (Math.Abs(herr0) > 0.01f)
637 { 601 {
638 m_dir.Z = -((herr0 * pTimestep * 50.0f) / m_VhoverTimescale); 602 m_newVelocity.Z = -((herr0 * pTimestep * 50.0f) / m_VhoverTimescale);
639 //KF: m_VhoverEfficiency is not yet implemented 603 //KF: m_VhoverEfficiency is not yet implemented
640 } 604 }
641 else 605 else
642 { 606 {
643 m_dir.Z = 0f; 607 m_newVelocity.Z = 0f;
644 } 608 }
645 } 609 }
646 610
647 VDetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", m_prim.LocalID, pos, m_dir, m_VhoverHeight, m_VhoverTargetHeight); 611 VDetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", m_prim.LocalID, pos, m_newVelocity, m_VhoverHeight, m_VhoverTargetHeight);
612 }
648 613
649// m_VhoverEfficiency = 0f; // 0=boucy, 1=Crit.damped 614 Vector3 posChange = pos - m_lastPositionVector;
650// m_VhoverTimescale = 0f; // time to acheive height 615 if (m_BlockingEndPoint != Vector3.Zero)
651// pTimestep is time since last frame,in secs 616 {
617 bool changed = false;
618 if (pos.X >= (m_BlockingEndPoint.X - (float)1))
619 {
620 pos.X -= posChange.X + 1;
621 changed = true;
622 }
623 if (pos.Y >= (m_BlockingEndPoint.Y - (float)1))
624 {
625 pos.Y -= posChange.Y + 1;
626 changed = true;
627 }
628 if (pos.Z >= (m_BlockingEndPoint.Z - (float)1))
629 {
630 pos.Z -= posChange.Z + 1;
631 changed = true;
632 }
633 if (pos.X <= 0)
634 {
635 pos.X += posChange.X + 1;
636 changed = true;
637 }
638 if (pos.Y <= 0)
639 {
640 pos.Y += posChange.Y + 1;
641 changed = true;
642 }
643 if (changed)
644 {
645 m_prim.Position = pos;
646 VDetailLog("{0},MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}",
647 m_prim.LocalID, m_BlockingEndPoint, posChange, pos);
648 }
652 } 649 }
653 650
651 float Zchange = Math.Abs(posChange.Z);
654 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0) 652 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
655 { 653 {
656 //Start Experimental Values
657 if (Zchange > .3) 654 if (Zchange > .3)
658 {
659 grav.Z = (float)(grav.Z * 3); 655 grav.Z = (float)(grav.Z * 3);
660 }
661 if (Zchange > .15) 656 if (Zchange > .15)
662 {
663 grav.Z = (float)(grav.Z * 2); 657 grav.Z = (float)(grav.Z * 2);
664 }
665 if (Zchange > .75) 658 if (Zchange > .75)
666 {
667 grav.Z = (float)(grav.Z * 1.5); 659 grav.Z = (float)(grav.Z * 1.5);
668 }
669 if (Zchange > .05) 660 if (Zchange > .05)
670 {
671 grav.Z = (float)(grav.Z * 1.25); 661 grav.Z = (float)(grav.Z * 1.25);
672 }
673 if (Zchange > .025) 662 if (Zchange > .025)
674 {
675 grav.Z = (float)(grav.Z * 1.125); 663 grav.Z = (float)(grav.Z * 1.125);
676 } 664 float postemp = (pos.Z - terrainHeight);
677 float terraintemp = m_prim.Scene.TerrainManager.GetTerrainHeightAtXYZ(pos);
678 float postemp = (pos.Z - terraintemp);
679 if (postemp > 2.5f) 665 if (postemp > 2.5f)
680 {
681 grav.Z = (float)(grav.Z * 1.037125); 666 grav.Z = (float)(grav.Z * 1.037125);
682 }
683 VDetailLog("{0},MoveLinear,limitMotorUp,grav={1}", m_prim.LocalID, grav); 667 VDetailLog("{0},MoveLinear,limitMotorUp,grav={1}", m_prim.LocalID, grav);
684 //End Experimental Values
685 } 668 }
686 if ((m_flags & (VehicleFlag.NO_X)) != 0) 669 if ((m_flags & (VehicleFlag.NO_X)) != 0)
687 { 670 m_newVelocity.X = 0;
688 m_dir.X = 0;
689 }
690 if ((m_flags & (VehicleFlag.NO_Y)) != 0) 671 if ((m_flags & (VehicleFlag.NO_Y)) != 0)
691 { 672 m_newVelocity.Y = 0;
692 m_dir.Y = 0;
693 }
694 if ((m_flags & (VehicleFlag.NO_Z)) != 0) 673 if ((m_flags & (VehicleFlag.NO_Z)) != 0)
695 { 674 m_newVelocity.Z = 0;
696 m_dir.Z = 0;
697 }
698
699 m_lastPositionVector = m_prim.Position;
700 675
701 // Apply velocity 676 // Apply velocity
702 m_prim.Velocity = m_dir; 677 m_prim.Velocity = m_newVelocity;
703 // apply gravity force 678 // apply gravity force
704 // Why is this set here? The physics engine already does gravity. 679 // Why is this set here? The physics engine already does gravity.
705 // m_prim.AddForce(grav, false); 680 // m_prim.AddForce(grav, false);
706 // m_prim.Force = grav;
707 681
708 // Apply friction 682 // Apply friction
709 Vector3 decayamount = Vector3.One / (m_linearFrictionTimescale / pTimestep); 683 Vector3 keepFraction = Vector3.One - (Vector3.One / (m_linearFrictionTimescale / pTimestep));
710 m_lastLinearVelocityVector -= m_lastLinearVelocityVector * decayamount; 684 m_lastLinearVelocityVector *= keepFraction;
711 685
712 VDetailLog("{0},MoveLinear,done,pos={1},vel={2},force={3},decay={4}", 686 VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4},1Mdecay={5}",
713 m_prim.LocalID, m_lastPositionVector, m_dir, grav, decayamount); 687 m_prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav, keepFraction);
714 688
715 } // end MoveLinear() 689 } // end MoveLinear()
716 690
@@ -735,17 +709,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin
735 // There are m_angularMotorApply steps. 709 // There are m_angularMotorApply steps.
736 Vector3 origAngularVelocity = m_angularMotorVelocity; 710 Vector3 origAngularVelocity = m_angularMotorVelocity;
737 // ramp up to new value 711 // ramp up to new value
738 // current velocity += error / (time to get there / step interval) 712 // current velocity += error / ( time to get there / step interval)
739 // requested speed - last motor speed 713 // requested speed - last motor speed
740 m_angularMotorVelocity.X += (m_angularMotorDirection.X - m_angularMotorVelocity.X) / (m_angularMotorTimescale / pTimestep); 714 m_angularMotorVelocity.X += (m_angularMotorDirection.X - m_angularMotorVelocity.X) / (m_angularMotorTimescale / pTimestep);
741 m_angularMotorVelocity.Y += (m_angularMotorDirection.Y - m_angularMotorVelocity.Y) / (m_angularMotorTimescale / pTimestep); 715 m_angularMotorVelocity.Y += (m_angularMotorDirection.Y - m_angularMotorVelocity.Y) / (m_angularMotorTimescale / pTimestep);
742 m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep); 716 m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep);
743 717
744 VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},origvel={2},dir={3},vel={4}", 718 VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},angTScale={2},timeStep={3},origvel={4},dir={5},vel={6}",
745 m_prim.LocalID,m_angularMotorApply,origAngularVelocity, m_angularMotorDirection, m_angularMotorVelocity); 719 m_prim.LocalID, m_angularMotorApply, m_angularMotorTimescale, pTimestep, origAngularVelocity, m_angularMotorDirection, m_angularMotorVelocity);
746 720
747 m_angularMotorApply--; // This is done so that if script request rate is less than phys frame rate the expected 721 // This is done so that if script request rate is less than phys frame rate the expected
748 // velocity may still be acheived. 722 // velocity may still be acheived.
723 m_angularMotorApply--;
749 } 724 }
750 else 725 else
751 { 726 {
@@ -760,7 +735,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
760 Vector3 vertattr = Vector3.Zero; 735 Vector3 vertattr = Vector3.Zero;
761 if (m_verticalAttractionTimescale < 300) 736 if (m_verticalAttractionTimescale < 300)
762 { 737 {
763 float VAservo = 0.2f / (m_verticalAttractionTimescale * pTimestep); 738 float VAservo = 0.2f / (m_verticalAttractionTimescale / pTimestep);
764 // get present body rotation 739 // get present body rotation
765 Quaternion rotq = m_prim.Orientation; 740 Quaternion rotq = m_prim.Orientation;
766 // make a vector pointing up 741 // make a vector pointing up
@@ -863,16 +838,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
863 m_rot.Y = 0; 838 m_rot.Y = 0;
864 changed = true; 839 changed = true;
865 } 840 }
866 if ((m_flags & VehicleFlag.LOCK_ROTATION) != 0)
867 {
868 m_rot.X = 0;
869 m_rot.Y = 0;
870 changed = true;
871 }
872 if (changed) 841 if (changed)
842 {
873 m_prim.Orientation = m_rot; 843 m_prim.Orientation = m_rot;
844 VDetailLog("{0},LimitRotation,done,orig={1},new={2}", m_prim.LocalID, rotq, m_rot);
845 }
874 846
875 VDetailLog("{0},LimitRotation,done,changed={1},orig={2},new={3}", m_prim.LocalID, changed, rotq, m_rot);
876 } 847 }
877 848
878 // Invoke the detailed logger and output something if it's enabled. 849 // Invoke the detailed logger and output something if it's enabled.