aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2013-03-31 17:36:15 -0700
committerRobert Adams2013-03-31 22:19:41 -0700
commit747ece59d20370115fdaf90a5a08ab77f5605b1c (patch)
tree7ff021fbc863e4562b01a6ffdfeb4313848ddb7e /OpenSim
parentBulletSim: Add physical 'actors' that operate on the physical object. (diff)
downloadopensim-SC_OLD-747ece59d20370115fdaf90a5a08ab77f5605b1c.zip
opensim-SC_OLD-747ece59d20370115fdaf90a5a08ab77f5605b1c.tar.gz
opensim-SC_OLD-747ece59d20370115fdaf90a5a08ab77f5605b1c.tar.bz2
opensim-SC_OLD-747ece59d20370115fdaf90a5a08ab77f5605b1c.tar.xz
BulletSim: convert BSDynamic to a BSActor and change BSPrim to set
up the vehicle actor.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs199
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs46
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs12
5 files changed, 149 insertions, 112 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 65df741..8b5da0d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -40,13 +40,14 @@ using OpenSim.Region.Physics.Manager;
40 40
41namespace OpenSim.Region.Physics.BulletSPlugin 41namespace OpenSim.Region.Physics.BulletSPlugin
42{ 42{
43 public sealed class BSDynamics 43 public sealed class BSDynamics : BSActor
44 { 44 {
45 private static string LogHeader = "[BULLETSIM VEHICLE]"; 45 private static string LogHeader = "[BULLETSIM VEHICLE]";
46 46
47 private BSScene PhysicsScene { get; set; }
48 // the prim this dynamic controller belongs to 47 // the prim this dynamic controller belongs to
49 private BSPrim Prim { get; set; } 48 private BSPrim ControllingPrim { get; set; }
49
50 private bool m_haveRegisteredForSceneEvents;
50 51
51 // mass of the vehicle fetched each time we're calles 52 // mass of the vehicle fetched each time we're calles
52 private float m_vehicleMass; 53 private float m_vehicleMass;
@@ -129,11 +130,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
129 public bool enableAngularDeflection; 130 public bool enableAngularDeflection;
130 public bool enableAngularBanking; 131 public bool enableAngularBanking;
131 132
132 public BSDynamics(BSScene myScene, BSPrim myPrim) 133 public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName)
134 : base(myScene, myPrim, actorName)
133 { 135 {
134 PhysicsScene = myScene; 136 ControllingPrim = myPrim;
135 Prim = myPrim;
136 Type = Vehicle.TYPE_NONE; 137 Type = Vehicle.TYPE_NONE;
138 m_haveRegisteredForSceneEvents = false;
137 SetupVehicleDebugging(); 139 SetupVehicleDebugging();
138 } 140 }
139 141
@@ -155,7 +157,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
155 // Return 'true' if this vehicle is doing vehicle things 157 // Return 'true' if this vehicle is doing vehicle things
156 public bool IsActive 158 public bool IsActive
157 { 159 {
158 get { return (Type != Vehicle.TYPE_NONE && Prim.IsPhysicallyActive); } 160 get { return (Type != Vehicle.TYPE_NONE && ControllingPrim.IsPhysicallyActive); }
159 } 161 }
160 162
161 // Return 'true' if this a vehicle that should be sitting on the ground 163 // Return 'true' if this a vehicle that should be sitting on the ground
@@ -167,7 +169,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
167 #region Vehicle parameter setting 169 #region Vehicle parameter setting
168 public void ProcessFloatVehicleParam(Vehicle pParam, float pValue) 170 public void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
169 { 171 {
170 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue); 172 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", ControllingPrim.LocalID, pParam, pValue);
171 switch (pParam) 173 switch (pParam)
172 { 174 {
173 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: 175 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
@@ -195,7 +197,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
195 break; 197 break;
196 case Vehicle.BUOYANCY: 198 case Vehicle.BUOYANCY:
197 m_VehicleBuoyancy = ClampInRange(-1f, pValue, 1f); 199 m_VehicleBuoyancy = ClampInRange(-1f, pValue, 1f);
198 m_VehicleGravity = Prim.ComputeGravity(m_VehicleBuoyancy); 200 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy);
199 break; 201 break;
200 case Vehicle.HOVER_EFFICIENCY: 202 case Vehicle.HOVER_EFFICIENCY:
201 m_VhoverEfficiency = ClampInRange(0f, pValue, 1f); 203 m_VhoverEfficiency = ClampInRange(0f, pValue, 1f);
@@ -258,7 +260,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
258 260
259 internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) 261 internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
260 { 262 {
261 VDetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue); 263 VDetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", ControllingPrim.LocalID, pParam, pValue);
262 switch (pParam) 264 switch (pParam)
263 { 265 {
264 case Vehicle.ANGULAR_FRICTION_TIMESCALE: 266 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
@@ -294,7 +296,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
294 296
295 internal void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue) 297 internal void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue)
296 { 298 {
297 VDetailLog("{0},ProcessRotationalVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue); 299 VDetailLog("{0},ProcessRotationalVehicleParam,param={1},val={2}", ControllingPrim.LocalID, pParam, pValue);
298 switch (pParam) 300 switch (pParam)
299 { 301 {
300 case Vehicle.REFERENCE_FRAME: 302 case Vehicle.REFERENCE_FRAME:
@@ -308,7 +310,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
308 310
309 internal void ProcessVehicleFlags(int pParam, bool remove) 311 internal void ProcessVehicleFlags(int pParam, bool remove)
310 { 312 {
311 VDetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", Prim.LocalID, pParam, remove); 313 VDetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", ControllingPrim.LocalID, pParam, remove);
312 VehicleFlag parm = (VehicleFlag)pParam; 314 VehicleFlag parm = (VehicleFlag)pParam;
313 if (pParam == -1) 315 if (pParam == -1)
314 m_flags = (VehicleFlag)0; 316 m_flags = (VehicleFlag)0;
@@ -323,7 +325,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
323 325
324 public void ProcessTypeChange(Vehicle pType) 326 public void ProcessTypeChange(Vehicle pType)
325 { 327 {
326 VDetailLog("{0},ProcessTypeChange,type={1}", Prim.LocalID, pType); 328 VDetailLog("{0},ProcessTypeChange,type={1}", ControllingPrim.LocalID, pType);
327 // Set Defaults For Type 329 // Set Defaults For Type
328 Type = pType; 330 Type = pType;
329 switch (pType) 331 switch (pType)
@@ -578,13 +580,23 @@ namespace OpenSim.Region.Physics.BulletSPlugin
578 m_verticalAttractionMotor.FrictionTimescale = new Vector3(BSMotor.Infinite, BSMotor.Infinite, 0.1f); 580 m_verticalAttractionMotor.FrictionTimescale = new Vector3(BSMotor.Infinite, BSMotor.Infinite, 0.1f);
579 m_verticalAttractionMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG DEBUG (enables detail logging) 581 m_verticalAttractionMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
580 */ 582 */
583
584 if (this.Type == Vehicle.TYPE_NONE)
585 {
586 UnregisterForSceneEvents();
587 }
588 else
589 {
590 RegisterForSceneEvents();
591 }
581 } 592 }
582 #endregion // Vehicle parameter setting 593 #endregion // Vehicle parameter setting
583 594
584 public void Refresh() 595 // BSActor.Refresh()
596 public override void Refresh()
585 { 597 {
586 // If asking for a refresh, reset the physical parameters before the next simulation step. 598 // If asking for a refresh, reset the physical parameters before the next simulation step.
587 PhysicsScene.PostTaintObject("BSDynamics.Refresh", Prim.LocalID, delegate() 599 PhysicsScene.PostTaintObject("BSDynamics.Refresh", ControllingPrim.LocalID, delegate()
588 { 600 {
589 SetPhysicalParameters(); 601 SetPhysicalParameters();
590 }); 602 });
@@ -597,49 +609,90 @@ namespace OpenSim.Region.Physics.BulletSPlugin
597 if (IsActive) 609 if (IsActive)
598 { 610 {
599 // Remember the mass so we don't have to fetch it every step 611 // Remember the mass so we don't have to fetch it every step
600 m_vehicleMass = Prim.TotalMass; 612 m_vehicleMass = ControllingPrim.TotalMass;
601 613
602 // Friction affects are handled by this vehicle code 614 // Friction affects are handled by this vehicle code
603 PhysicsScene.PE.SetFriction(Prim.PhysBody, BSParam.VehicleFriction); 615 PhysicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction);
604 PhysicsScene.PE.SetRestitution(Prim.PhysBody, BSParam.VehicleRestitution); 616 PhysicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution);
605 617
606 // Moderate angular movement introduced by Bullet. 618 // Moderate angular movement introduced by Bullet.
607 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. 619 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
608 // Maybe compute linear and angular factor and damping from params. 620 // Maybe compute linear and angular factor and damping from params.
609 PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, BSParam.VehicleAngularDamping); 621 PhysicsScene.PE.SetAngularDamping(ControllingPrim.PhysBody, BSParam.VehicleAngularDamping);
610 PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactor); 622 PhysicsScene.PE.SetLinearFactor(ControllingPrim.PhysBody, BSParam.VehicleLinearFactor);
611 PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactor); 623 PhysicsScene.PE.SetAngularFactorV(ControllingPrim.PhysBody, BSParam.VehicleAngularFactor);
612 624
613 // Vehicles report collision events so we know when it's on the ground 625 // Vehicles report collision events so we know when it's on the ground
614 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 626 PhysicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
615 627
616 Prim.Inertia = PhysicsScene.PE.CalculateLocalInertia(Prim.PhysShape, m_vehicleMass); 628 ControllingPrim.Inertia = PhysicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape, m_vehicleMass);
617 PhysicsScene.PE.SetMassProps(Prim.PhysBody, m_vehicleMass, Prim.Inertia); 629 PhysicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia);
618 PhysicsScene.PE.UpdateInertiaTensor(Prim.PhysBody); 630 PhysicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody);
619 631
620 // Set the gravity for the vehicle depending on the buoyancy 632 // Set the gravity for the vehicle depending on the buoyancy
621 // TODO: what should be done if prim and vehicle buoyancy differ? 633 // TODO: what should be done if prim and vehicle buoyancy differ?
622 m_VehicleGravity = Prim.ComputeGravity(m_VehicleBuoyancy); 634 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy);
623 // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. 635 // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same.
624 PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); 636 PhysicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero);
625 637
626 VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", 638 VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}",
627 Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity, 639 ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity,
628 BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution, 640 BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution,
629 BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor 641 BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor
630 ); 642 );
631 } 643 }
632 else 644 else
633 { 645 {
634 if (Prim.PhysBody.HasPhysicalBody) 646 if (ControllingPrim.PhysBody.HasPhysicalBody)
635 PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 647 PhysicsScene.PE.RemoveFromCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
636 } 648 }
637 } 649 }
638 650
639 public bool RemoveBodyDependencies(BSPhysObject prim) 651 // BSActor.RemoveBodyDependencies
652 public override void RemoveBodyDependencies()
640 { 653 {
641 Refresh(); 654 Refresh();
642 return IsActive; 655 }
656
657 // BSActor.Release()
658 public override void Dispose()
659 {
660 UnregisterForSceneEvents();
661 Type = Vehicle.TYPE_NONE;
662 Enabled = false;
663 return;
664 }
665
666 private void RegisterForSceneEvents()
667 {
668 if (!m_haveRegisteredForSceneEvents)
669 {
670 PhysicsScene.BeforeStep += this.Step;
671 PhysicsScene.AfterStep += this.PostStep;
672 ControllingPrim.OnPreUpdateProperty += this.PreUpdateProperty;
673 m_haveRegisteredForSceneEvents = true;
674 }
675 }
676
677 private void UnregisterForSceneEvents()
678 {
679 if (m_haveRegisteredForSceneEvents)
680 {
681 PhysicsScene.BeforeStep -= this.Step;
682 PhysicsScene.AfterStep -= this.PostStep;
683 ControllingPrim.OnPreUpdateProperty -= this.PreUpdateProperty;
684 m_haveRegisteredForSceneEvents = false;
685 }
686 }
687
688 private void PreUpdateProperty(ref EntityProperties entprop)
689 {
690 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet
691 // TODO: handle physics introduced by Bullet with computed vehicle physics.
692 if (IsActive)
693 {
694 entprop.RotationalVelocity = Vector3.Zero;
695 }
643 } 696 }
644 697
645 #region Known vehicle value functions 698 #region Known vehicle value functions
@@ -686,14 +739,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
686 if (m_knownChanged != 0) 739 if (m_knownChanged != 0)
687 { 740 {
688 if ((m_knownChanged & m_knownChangedPosition) != 0) 741 if ((m_knownChanged & m_knownChangedPosition) != 0)
689 Prim.ForcePosition = m_knownPosition; 742 ControllingPrim.ForcePosition = m_knownPosition;
690 743
691 if ((m_knownChanged & m_knownChangedOrientation) != 0) 744 if ((m_knownChanged & m_knownChangedOrientation) != 0)
692 Prim.ForceOrientation = m_knownOrientation; 745 ControllingPrim.ForceOrientation = m_knownOrientation;
693 746
694 if ((m_knownChanged & m_knownChangedVelocity) != 0) 747 if ((m_knownChanged & m_knownChangedVelocity) != 0)
695 { 748 {
696 Prim.ForceVelocity = m_knownVelocity; 749 ControllingPrim.ForceVelocity = m_knownVelocity;
697 // Fake out Bullet by making it think the velocity is the same as last time. 750 // Fake out Bullet by making it think the velocity is the same as last time.
698 // Bullet does a bunch of smoothing for changing parameters. 751 // Bullet does a bunch of smoothing for changing parameters.
699 // Since the vehicle is demanding this setting, we override Bullet's smoothing 752 // Since the vehicle is demanding this setting, we override Bullet's smoothing
@@ -702,28 +755,28 @@ namespace OpenSim.Region.Physics.BulletSPlugin
702 } 755 }
703 756
704 if ((m_knownChanged & m_knownChangedForce) != 0) 757 if ((m_knownChanged & m_knownChangedForce) != 0)
705 Prim.AddForce((Vector3)m_knownForce, false /*pushForce*/, true /*inTaintTime*/); 758 ControllingPrim.AddForce((Vector3)m_knownForce, false /*pushForce*/, true /*inTaintTime*/);
706 759
707 if ((m_knownChanged & m_knownChangedForceImpulse) != 0) 760 if ((m_knownChanged & m_knownChangedForceImpulse) != 0)
708 Prim.AddForceImpulse((Vector3)m_knownForceImpulse, false /*pushforce*/, true /*inTaintTime*/); 761 ControllingPrim.AddForceImpulse((Vector3)m_knownForceImpulse, false /*pushforce*/, true /*inTaintTime*/);
709 762
710 if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0) 763 if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0)
711 { 764 {
712 Prim.ForceRotationalVelocity = m_knownRotationalVelocity; 765 ControllingPrim.ForceRotationalVelocity = m_knownRotationalVelocity;
713 // PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity); 766 // PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity);
714 } 767 }
715 768
716 if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0) 769 if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0)
717 Prim.ApplyTorqueImpulse((Vector3)m_knownRotationalImpulse, true /*inTaintTime*/); 770 ControllingPrim.ApplyTorqueImpulse((Vector3)m_knownRotationalImpulse, true /*inTaintTime*/);
718 771
719 if ((m_knownChanged & m_knownChangedRotationalForce) != 0) 772 if ((m_knownChanged & m_knownChangedRotationalForce) != 0)
720 { 773 {
721 Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); 774 ControllingPrim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/);
722 } 775 }
723 776
724 // If we set one of the values (ie, the physics engine didn't do it) we must force 777 // If we set one of the values (ie, the physics engine didn't do it) we must force
725 // an UpdateProperties event to send the changes up to the simulator. 778 // an UpdateProperties event to send the changes up to the simulator.
726 PhysicsScene.PE.PushUpdate(Prim.PhysBody); 779 PhysicsScene.PE.PushUpdate(ControllingPrim.PhysBody);
727 } 780 }
728 m_knownChanged = 0; 781 m_knownChanged = 0;
729 } 782 }
@@ -736,7 +789,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
736 if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos) 789 if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos)
737 { 790 {
738 lastRememberedHeightPos = pos; 791 lastRememberedHeightPos = pos;
739 m_knownTerrainHeight = Prim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos); 792 m_knownTerrainHeight = ControllingPrim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos);
740 m_knownHas |= m_knownChangedTerrainHeight; 793 m_knownHas |= m_knownChangedTerrainHeight;
741 } 794 }
742 return m_knownTerrainHeight; 795 return m_knownTerrainHeight;
@@ -748,7 +801,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
748 { 801 {
749 if ((m_knownHas & m_knownChangedWaterLevel) == 0) 802 if ((m_knownHas & m_knownChangedWaterLevel) == 0)
750 { 803 {
751 m_knownWaterLevel = Prim.PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(pos); 804 m_knownWaterLevel = ControllingPrim.PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(pos);
752 m_knownHas |= m_knownChangedWaterLevel; 805 m_knownHas |= m_knownChangedWaterLevel;
753 } 806 }
754 return (float)m_knownWaterLevel; 807 return (float)m_knownWaterLevel;
@@ -760,7 +813,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
760 { 813 {
761 if ((m_knownHas & m_knownChangedPosition) == 0) 814 if ((m_knownHas & m_knownChangedPosition) == 0)
762 { 815 {
763 m_knownPosition = Prim.ForcePosition; 816 m_knownPosition = ControllingPrim.ForcePosition;
764 m_knownHas |= m_knownChangedPosition; 817 m_knownHas |= m_knownChangedPosition;
765 } 818 }
766 return m_knownPosition; 819 return m_knownPosition;
@@ -779,7 +832,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
779 { 832 {
780 if ((m_knownHas & m_knownChangedOrientation) == 0) 833 if ((m_knownHas & m_knownChangedOrientation) == 0)
781 { 834 {
782 m_knownOrientation = Prim.ForceOrientation; 835 m_knownOrientation = ControllingPrim.ForceOrientation;
783 m_knownHas |= m_knownChangedOrientation; 836 m_knownHas |= m_knownChangedOrientation;
784 } 837 }
785 return m_knownOrientation; 838 return m_knownOrientation;
@@ -798,7 +851,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
798 { 851 {
799 if ((m_knownHas & m_knownChangedVelocity) == 0) 852 if ((m_knownHas & m_knownChangedVelocity) == 0)
800 { 853 {
801 m_knownVelocity = Prim.ForceVelocity; 854 m_knownVelocity = ControllingPrim.ForceVelocity;
802 m_knownHas |= m_knownChangedVelocity; 855 m_knownHas |= m_knownChangedVelocity;
803 } 856 }
804 return m_knownVelocity; 857 return m_knownVelocity;
@@ -839,7 +892,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
839 { 892 {
840 if ((m_knownHas & m_knownChangedRotationalVelocity) == 0) 893 if ((m_knownHas & m_knownChangedRotationalVelocity) == 0)
841 { 894 {
842 m_knownRotationalVelocity = Prim.ForceRotationalVelocity; 895 m_knownRotationalVelocity = ControllingPrim.ForceRotationalVelocity;
843 m_knownHas |= m_knownChangedRotationalVelocity; 896 m_knownHas |= m_knownChangedRotationalVelocity;
844 } 897 }
845 return (Vector3)m_knownRotationalVelocity; 898 return (Vector3)m_knownRotationalVelocity;
@@ -915,10 +968,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
915 PushKnownChanged(); 968 PushKnownChanged();
916 969
917 if (PhysicsScene.VehiclePhysicalLoggingEnabled) 970 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
918 PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, Prim.PhysBody); 971 PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, ControllingPrim.PhysBody);
919 972
920 VDetailLog("{0},BSDynamics.Step,done,pos={1}, force={2},velocity={3},angvel={4}", 973 VDetailLog("{0},BSDynamics.Step,done,pos={1}, force={2},velocity={3},angvel={4}",
921 Prim.LocalID, VehiclePosition, m_knownForce, VehicleVelocity, VehicleRotationalVelocity); 974 ControllingPrim.LocalID, VehiclePosition, m_knownForce, VehicleVelocity, VehicleRotationalVelocity);
922 } 975 }
923 976
924 // Called after the simulation step 977 // Called after the simulation step
@@ -927,7 +980,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
927 if (!IsActive) return; 980 if (!IsActive) return;
928 981
929 if (PhysicsScene.VehiclePhysicalLoggingEnabled) 982 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
930 PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, Prim.PhysBody); 983 PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, ControllingPrim.PhysBody);
931 } 984 }
932 985
933 // Apply the effect of the linear motor and other linear motions (like hover and float). 986 // Apply the effect of the linear motor and other linear motions (like hover and float).
@@ -967,12 +1020,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
967 VehicleVelocity /= VehicleVelocity.Length(); 1020 VehicleVelocity /= VehicleVelocity.Length();
968 VehicleVelocity *= BSParam.VehicleMaxLinearVelocity; 1021 VehicleVelocity *= BSParam.VehicleMaxLinearVelocity;
969 VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}", 1022 VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}",
970 Prim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity); 1023 ControllingPrim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity);
971 } 1024 }
972 else if (newVelocityLengthSq < 0.001f) 1025 else if (newVelocityLengthSq < 0.001f)
973 VehicleVelocity = Vector3.Zero; 1026 VehicleVelocity = Vector3.Zero;
974 1027
975 VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", Prim.LocalID, Prim.IsColliding, VehicleVelocity ); 1028 VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", ControllingPrim.LocalID, ControllingPrim.IsColliding, VehicleVelocity );
976 1029
977 } // end MoveLinear() 1030 } // end MoveLinear()
978 1031
@@ -997,7 +1050,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
997 VehicleVelocity += linearMotorVelocityW; 1050 VehicleVelocity += linearMotorVelocityW;
998 1051
999 VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5}", 1052 VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5}",
1000 Prim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, linearMotorVelocityW, VehicleVelocity); 1053 ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, linearMotorVelocityW, VehicleVelocity);
1001 } 1054 }
1002 1055
1003 public void ComputeLinearTerrainHeightCorrection(float pTimestep) 1056 public void ComputeLinearTerrainHeightCorrection(float pTimestep)
@@ -1011,7 +1064,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1011 newPosition.Z = GetTerrainHeight(VehiclePosition) + 1f; 1064 newPosition.Z = GetTerrainHeight(VehiclePosition) + 1f;
1012 VehiclePosition = newPosition; 1065 VehiclePosition = newPosition;
1013 VDetailLog("{0}, MoveLinear,terrainHeight,terrainHeight={1},pos={2}", 1066 VDetailLog("{0}, MoveLinear,terrainHeight,terrainHeight={1},pos={2}",
1014 Prim.LocalID, GetTerrainHeight(VehiclePosition), VehiclePosition); 1067 ControllingPrim.LocalID, GetTerrainHeight(VehiclePosition), VehiclePosition);
1015 } 1068 }
1016 } 1069 }
1017 1070
@@ -1050,7 +1103,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1050 pos.Z = m_VhoverTargetHeight; 1103 pos.Z = m_VhoverTargetHeight;
1051 VehiclePosition = pos; 1104 VehiclePosition = pos;
1052 1105
1053 VDetailLog("{0}, MoveLinear,hover,pos={1},lockHoverHeight", Prim.LocalID, pos); 1106 VDetailLog("{0}, MoveLinear,hover,pos={1},lockHoverHeight", ControllingPrim.LocalID, pos);
1054 } 1107 }
1055 } 1108 }
1056 else 1109 else
@@ -1079,7 +1132,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1079 */ 1132 */
1080 1133
1081 VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corr={7}", 1134 VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corr={7}",
1082 Prim.LocalID, VehiclePosition, m_VhoverEfficiency, 1135 ControllingPrim.LocalID, VehiclePosition, m_VhoverEfficiency,
1083 m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, 1136 m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight,
1084 verticalError, verticalCorrection); 1137 verticalError, verticalCorrection);
1085 } 1138 }
@@ -1124,7 +1177,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1124 { 1177 {
1125 VehiclePosition = pos; 1178 VehiclePosition = pos;
1126 VDetailLog("{0}, MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}", 1179 VDetailLog("{0}, MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}",
1127 Prim.LocalID, m_BlockingEndPoint, posChange, pos); 1180 ControllingPrim.LocalID, m_BlockingEndPoint, posChange, pos);
1128 } 1181 }
1129 } 1182 }
1130 return changed; 1183 return changed;
@@ -1164,7 +1217,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1164 1217
1165 // Another approach is to measure if we're going up. If going up and not colliding, 1218 // Another approach is to measure if we're going up. If going up and not colliding,
1166 // the vehicle is in the air. Fix that by pushing down. 1219 // the vehicle is in the air. Fix that by pushing down.
1167 if (!Prim.IsColliding && VehicleVelocity.Z > 0.1) 1220 if (!ControllingPrim.IsColliding && VehicleVelocity.Z > 0.1)
1168 { 1221 {
1169 // Get rid of any of the velocity vector that is pushing us up. 1222 // Get rid of any of the velocity vector that is pushing us up.
1170 float upVelocity = VehicleVelocity.Z; 1223 float upVelocity = VehicleVelocity.Z;
@@ -1186,7 +1239,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1186 } 1239 }
1187 */ 1240 */
1188 VDetailLog("{0}, MoveLinear,limitMotorUp,collide={1},upVel={2},newVel={3}", 1241 VDetailLog("{0}, MoveLinear,limitMotorUp,collide={1},upVel={2},newVel={3}",
1189 Prim.LocalID, Prim.IsColliding, upVelocity, VehicleVelocity); 1242 ControllingPrim.LocalID, ControllingPrim.IsColliding, upVelocity, VehicleVelocity);
1190 } 1243 }
1191 } 1244 }
1192 } 1245 }
@@ -1196,14 +1249,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1196 Vector3 appliedGravity = m_VehicleGravity * m_vehicleMass; 1249 Vector3 appliedGravity = m_VehicleGravity * m_vehicleMass;
1197 1250
1198 // Hack to reduce downward force if the vehicle is probably sitting on the ground 1251 // Hack to reduce downward force if the vehicle is probably sitting on the ground
1199 if (Prim.IsColliding && IsGroundVehicle) 1252 if (ControllingPrim.IsColliding && IsGroundVehicle)
1200 appliedGravity *= BSParam.VehicleGroundGravityFudge; 1253 appliedGravity *= BSParam.VehicleGroundGravityFudge;
1201 1254
1202 VehicleAddForce(appliedGravity); 1255 VehicleAddForce(appliedGravity);
1203 1256
1204 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={3}", 1257 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={3}",
1205 Prim.LocalID, m_VehicleGravity, 1258 ControllingPrim.LocalID, m_VehicleGravity,
1206 Prim.IsColliding, BSParam.VehicleGroundGravityFudge, m_vehicleMass, appliedGravity); 1259 ControllingPrim.IsColliding, BSParam.VehicleGroundGravityFudge, m_vehicleMass, appliedGravity);
1207 } 1260 }
1208 1261
1209 // ======================================================================= 1262 // =======================================================================
@@ -1227,11 +1280,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1227 { 1280 {
1228 // The vehicle is not adding anything angular wise. 1281 // The vehicle is not adding anything angular wise.
1229 VehicleRotationalVelocity = Vector3.Zero; 1282 VehicleRotationalVelocity = Vector3.Zero;
1230 VDetailLog("{0}, MoveAngular,done,zero", Prim.LocalID); 1283 VDetailLog("{0}, MoveAngular,done,zero", ControllingPrim.LocalID);
1231 } 1284 }
1232 else 1285 else
1233 { 1286 {
1234 VDetailLog("{0}, MoveAngular,done,nonZero,angVel={1}", Prim.LocalID, VehicleRotationalVelocity); 1287 VDetailLog("{0}, MoveAngular,done,nonZero,angVel={1}", ControllingPrim.LocalID, VehicleRotationalVelocity);
1235 } 1288 }
1236 1289
1237 // ================================================================== 1290 // ==================================================================
@@ -1262,7 +1315,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1262 torqueFromOffset.Z = 0; 1315 torqueFromOffset.Z = 0;
1263 1316
1264 VehicleAddAngularForce(torqueFromOffset * m_vehicleMass); 1317 VehicleAddAngularForce(torqueFromOffset * m_vehicleMass);
1265 VDetailLog("{0}, BSDynamic.MoveAngular,motorOffset,applyTorqueImpulse={1}", Prim.LocalID, torqueFromOffset); 1318 VDetailLog("{0}, BSDynamic.MoveAngular,motorOffset,applyTorqueImpulse={1}", ControllingPrim.LocalID, torqueFromOffset);
1266 } 1319 }
1267 1320
1268 } 1321 }
@@ -1288,7 +1341,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1288 // } 1341 // }
1289 1342
1290 VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; 1343 VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation;
1291 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", Prim.LocalID, angularMotorContributionV); 1344 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", ControllingPrim.LocalID, angularMotorContributionV);
1292 } 1345 }
1293 1346
1294 // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial: 1347 // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial:
@@ -1334,7 +1387,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1334 VehicleRotationalVelocity += vertContributionV; 1387 VehicleRotationalVelocity += vertContributionV;
1335 1388
1336 VDetailLog("{0}, MoveAngular,verticalAttraction,diffAxis={1},diffAng={2},corrRot={3},contrib={4}", 1389 VDetailLog("{0}, MoveAngular,verticalAttraction,diffAxis={1},diffAng={2},corrRot={3},contrib={4}",
1337 Prim.LocalID, 1390 ControllingPrim.LocalID,
1338 differenceAxis, 1391 differenceAxis,
1339 differenceAngle, 1392 differenceAngle,
1340 correctionRotation, 1393 correctionRotation,
@@ -1433,9 +1486,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1433 VehicleRotationalVelocity += deflectContributionV * VehicleOrientation; 1486 VehicleRotationalVelocity += deflectContributionV * VehicleOrientation;
1434 1487
1435 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}", 1488 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}",
1436 Prim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContributionV); 1489 ControllingPrim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContributionV);
1437 VDetailLog("{0}, MoveAngular,Deflection,fwdSpd={1},defEff={2},defTS={3}", 1490 VDetailLog("{0}, MoveAngular,Deflection,fwdSpd={1},defEff={2},defTS={3}",
1438 Prim.LocalID, VehicleForwardSpeed, m_angularDeflectionEfficiency, m_angularDeflectionTimescale); 1491 ControllingPrim.LocalID, VehicleForwardSpeed, m_angularDeflectionEfficiency, m_angularDeflectionTimescale);
1439 } 1492 }
1440 } 1493 }
1441 1494
@@ -1501,7 +1554,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1501 1554
1502 1555
1503 VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}", 1556 VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}",
1504 Prim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContributionV); 1557 ControllingPrim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContributionV);
1505 } 1558 }
1506 } 1559 }
1507 1560
@@ -1540,7 +1593,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1540 if (rotq != m_rot) 1593 if (rotq != m_rot)
1541 { 1594 {
1542 VehicleOrientation = m_rot; 1595 VehicleOrientation = m_rot;
1543 VDetailLog("{0}, LimitRotation,done,orig={1},new={2}", Prim.LocalID, rotq, m_rot); 1596 VDetailLog("{0}, LimitRotation,done,orig={1},new={2}", ControllingPrim.LocalID, rotq, m_rot);
1544 } 1597 }
1545 1598
1546 } 1599 }
@@ -1554,8 +1607,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1554 // Invoke the detailed logger and output something if it's enabled. 1607 // Invoke the detailed logger and output something if it's enabled.
1555 private void VDetailLog(string msg, params Object[] args) 1608 private void VDetailLog(string msg, params Object[] args)
1556 { 1609 {
1557 if (Prim.PhysicsScene.VehicleLoggingEnabled) 1610 if (ControllingPrim.PhysicsScene.VehicleLoggingEnabled)
1558 Prim.PhysicsScene.DetailLog(msg, args); 1611 ControllingPrim.PhysicsScene.DetailLog(msg, args);
1559 } 1612 }
1560 } 1613 }
1561} 1614}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index cba2646..98ea833 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -187,7 +187,7 @@ public abstract class BSPhysObject : PhysicsActor
187 Friction = matAttrib.friction; 187 Friction = matAttrib.friction;
188 Restitution = matAttrib.restitution; 188 Restitution = matAttrib.restitution;
189 Density = matAttrib.density / BSParam.DensityScaleFactor; 189 Density = matAttrib.density / BSParam.DensityScaleFactor;
190 DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density); 190 // DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density);
191 } 191 }
192 192
193 // Stop all physical motion. 193 // Stop all physical motion.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 68a6c41..ec78fdc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -72,7 +72,8 @@ public class BSPrim : BSPhysObject
72 72
73 private int CrossingFailures { get; set; } 73 private int CrossingFailures { get; set; }
74 74
75 public BSDynamics VehicleController { get; private set; } 75 public BSDynamics VehicleActor;
76 public string VehicleActorName = "BasicVehicle";
76 77
77 private BSVMotor _targetMotor; 78 private BSVMotor _targetMotor;
78 private OMV.Vector3 _PIDTarget; 79 private OMV.Vector3 _PIDTarget;
@@ -100,11 +101,12 @@ public class BSPrim : BSPhysObject
100 _isPhysical = pisPhysical; 101 _isPhysical = pisPhysical;
101 _isVolumeDetect = false; 102 _isVolumeDetect = false;
102 103
103 VehicleController = new BSDynamics(PhysicsScene, this); // add vehicleness 104 VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName);
105 PhysicalActors.Add(VehicleActorName, VehicleActor);
104 106
105 _mass = CalculateMass(); 107 _mass = CalculateMass();
106 108
107 DetailLog("{0},BSPrim.constructor,call", LocalID); 109 // DetailLog("{0},BSPrim.constructor,call", LocalID);
108 // do the actual object creation at taint time 110 // do the actual object creation at taint time
109 PhysicsScene.TaintedObject("BSPrim.create", delegate() 111 PhysicsScene.TaintedObject("BSPrim.create", delegate()
110 { 112 {
@@ -272,6 +274,7 @@ public class BSPrim : BSPhysObject
272 { 274 {
273 PhysicsScene.TaintedObject("BSPrim.LockAngularMotion", delegate() 275 PhysicsScene.TaintedObject("BSPrim.LockAngularMotion", delegate()
274 { 276 {
277 DetailLog("{0},BSPrim.LockAngularMotion,taint,registeringLockAxisActor", LocalID);
275 // If there is not already an axis locker, make one 278 // If there is not already an axis locker, make one
276 if (!PhysicalActors.HasActor(LockedAxisActorName)) 279 if (!PhysicalActors.HasActor(LockedAxisActorName))
277 { 280 {
@@ -537,7 +540,7 @@ public class BSPrim : BSPhysObject
537 540
538 public override int VehicleType { 541 public override int VehicleType {
539 get { 542 get {
540 return (int)VehicleController.Type; // if we are a vehicle, return that type 543 return (int)VehicleActor.Type; // if we are a vehicle, return that type
541 } 544 }
542 set { 545 set {
543 Vehicle type = (Vehicle)value; 546 Vehicle type = (Vehicle)value;
@@ -546,20 +549,8 @@ public class BSPrim : BSPhysObject
546 { 549 {
547 // Done at taint time so we're sure the physics engine is not using the variables 550 // Done at taint time so we're sure the physics engine is not using the variables
548 // Vehicle code changes the parameters for this vehicle type. 551 // Vehicle code changes the parameters for this vehicle type.
549 VehicleController.ProcessTypeChange(type); 552 VehicleActor.ProcessTypeChange(type);
550 ActivateIfPhysical(false); 553 ActivateIfPhysical(false);
551
552 // If an active vehicle, register the vehicle code to be called before each step
553 if (VehicleController.Type == Vehicle.TYPE_NONE)
554 {
555 UnRegisterPreStepAction("BSPrim.Vehicle", LocalID);
556 UnRegisterPostStepAction("BSPrim.Vehicle", LocalID);
557 }
558 else
559 {
560 RegisterPreStepAction("BSPrim.Vehicle", LocalID, VehicleController.Step);
561 RegisterPostStepAction("BSPrim.Vehicle", LocalID, VehicleController.PostStep);
562 }
563 }); 554 });
564 } 555 }
565 } 556 }
@@ -567,7 +558,7 @@ public class BSPrim : BSPhysObject
567 { 558 {
568 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() 559 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
569 { 560 {
570 VehicleController.ProcessFloatVehicleParam((Vehicle)param, value); 561 VehicleActor.ProcessFloatVehicleParam((Vehicle)param, value);
571 ActivateIfPhysical(false); 562 ActivateIfPhysical(false);
572 }); 563 });
573 } 564 }
@@ -575,7 +566,7 @@ public class BSPrim : BSPhysObject
575 { 566 {
576 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() 567 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
577 { 568 {
578 VehicleController.ProcessVectorVehicleParam((Vehicle)param, value); 569 VehicleActor.ProcessVectorVehicleParam((Vehicle)param, value);
579 ActivateIfPhysical(false); 570 ActivateIfPhysical(false);
580 }); 571 });
581 } 572 }
@@ -583,7 +574,7 @@ public class BSPrim : BSPhysObject
583 { 574 {
584 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() 575 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
585 { 576 {
586 VehicleController.ProcessRotationVehicleParam((Vehicle)param, rotation); 577 VehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation);
587 ActivateIfPhysical(false); 578 ActivateIfPhysical(false);
588 }); 579 });
589 } 580 }
@@ -591,7 +582,7 @@ public class BSPrim : BSPhysObject
591 { 582 {
592 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() 583 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate()
593 { 584 {
594 VehicleController.ProcessVehicleFlags(param, remove); 585 VehicleActor.ProcessVehicleFlags(param, remove);
595 }); 586 });
596 } 587 }
597 588
@@ -848,7 +839,7 @@ public class BSPrim : BSPhysObject
848 MakeDynamic(IsStatic); 839 MakeDynamic(IsStatic);
849 840
850 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters) 841 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters)
851 VehicleController.Refresh(); 842 VehicleActor.Refresh();
852 PhysicalActors.Refresh(); 843 PhysicalActors.Refresh();
853 844
854 // Arrange for collision events if the simulator wants them 845 // Arrange for collision events if the simulator wants them
@@ -1655,9 +1646,9 @@ public class BSPrim : BSPhysObject
1655 volume *= (profileEnd - profileBegin); 1646 volume *= (profileEnd - profileBegin);
1656 1647
1657 returnMass = Density * BSParam.DensityScaleFactor * volume; 1648 returnMass = Density * BSParam.DensityScaleFactor * volume;
1658 DetailLog("{0},BSPrim.CalculateMass,den={1},vol={2},mass={3}", LocalID, Density, volume, returnMass);
1659 1649
1660 returnMass = Util.Clamp(returnMass, BSParam.MinimumObjectMass, BSParam.MaximumObjectMass); 1650 returnMass = Util.Clamp(returnMass, BSParam.MinimumObjectMass, BSParam.MaximumObjectMass);
1651 // DetailLog("{0},BSPrim.CalculateMass,den={1},vol={2},mass={3}", LocalID, Density, volume, returnMass);
1661 1652
1662 return returnMass; 1653 return returnMass;
1663 }// end CalculateMass 1654 }// end CalculateMass
@@ -1686,7 +1677,7 @@ public class BSPrim : BSPhysObject
1686 1677
1687 protected virtual void RemoveBodyDependencies() 1678 protected virtual void RemoveBodyDependencies()
1688 { 1679 {
1689 VehicleController.RemoveBodyDependencies(this); 1680 VehicleActor.RemoveBodyDependencies();
1690 PhysicalActors.RemoveBodyDependencies(); 1681 PhysicalActors.RemoveBodyDependencies();
1691 } 1682 }
1692 1683
@@ -1696,13 +1687,6 @@ public class BSPrim : BSPhysObject
1696 { 1687 {
1697 TriggerPreUpdatePropertyAction(ref entprop); 1688 TriggerPreUpdatePropertyAction(ref entprop);
1698 1689
1699 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet
1700 // TODO: handle physics introduced by Bullet with computed vehicle physics.
1701 if (VehicleController.IsActive)
1702 {
1703 entprop.RotationalVelocity = OMV.Vector3.Zero;
1704 }
1705
1706 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1690 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1707 1691
1708 // Assign directly to the local variables so the normal set actions do not happen 1692 // Assign directly to the local variables so the normal set actions do not happen
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index e6aefd5..9818b05 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -463,7 +463,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
463 463
464 if (!m_initialized) return null; 464 if (!m_initialized) return null;
465 465
466 DetailLog("{0},BSScene.AddPrimShape,call", localID); 466 // DetailLog("{0},BSScene.AddPrimShape,call", localID);
467 467
468 BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical); 468 BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical);
469 lock (PhysObjects) PhysObjects.Add(localID, prim); 469 lock (PhysObjects) PhysObjects.Add(localID, prim);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
index 33232bd..b040e21 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
@@ -114,9 +114,9 @@ public class BasicVehicles : OpenSimTestCase
114 // Instead the appropriate values are set and calls are made just the parts of the 114 // Instead the appropriate values are set and calls are made just the parts of the
115 // controller we want to exercise. Stepping the physics engine then applies 115 // controller we want to exercise. Stepping the physics engine then applies
116 // the actions of that one feature. 116 // the actions of that one feature.
117 TestVehicle.VehicleController.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency); 117 TestVehicle.VehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency);
118 TestVehicle.VehicleController.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale); 118 TestVehicle.VehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale);
119 TestVehicle.VehicleController.enableAngularVerticalAttraction = true; 119 TestVehicle.VehicleActor.enableAngularVerticalAttraction = true;
120 120
121 TestVehicle.IsPhysical = true; 121 TestVehicle.IsPhysical = true;
122 PhysicsScene.ProcessTaints(); 122 PhysicsScene.ProcessTaints();
@@ -124,9 +124,9 @@ public class BasicVehicles : OpenSimTestCase
124 // Step the simulator a bunch of times and vertical attraction should orient the vehicle up 124 // Step the simulator a bunch of times and vertical attraction should orient the vehicle up
125 for (int ii = 0; ii < simSteps; ii++) 125 for (int ii = 0; ii < simSteps; ii++)
126 { 126 {
127 TestVehicle.VehicleController.ForgetKnownVehicleProperties(); 127 TestVehicle.VehicleActor.ForgetKnownVehicleProperties();
128 TestVehicle.VehicleController.ComputeAngularVerticalAttraction(); 128 TestVehicle.VehicleActor.ComputeAngularVerticalAttraction();
129 TestVehicle.VehicleController.PushKnownChanged(); 129 TestVehicle.VehicleActor.PushKnownChanged();
130 130
131 PhysicsScene.Simulate(simulationTimeStep); 131 PhysicsScene.Simulate(simulationTimeStep);
132 } 132 }