aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
authorRobert Adams2012-07-18 08:49:01 -0700
committerRobert Adams2012-07-20 14:02:29 -0700
commit7451bb16137fad6336fae12608ef6df92ba1a46c (patch)
treecdf12be395b7058310f63647fd685b1ae0951071 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
parentBulletSim: Add very detailed logging to BSDynamics for vehicle debugging (diff)
downloadopensim-SC-7451bb16137fad6336fae12608ef6df92ba1a46c.zip
opensim-SC-7451bb16137fad6336fae12608ef6df92ba1a46c.tar.gz
opensim-SC-7451bb16137fad6336fae12608ef6df92ba1a46c.tar.bz2
opensim-SC-7451bb16137fad6336fae12608ef6df92ba1a46c.tar.xz
BulletSim: fix compile errors from last commit. Clean up passing of physics scene into vehicle dynamics code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs23
1 files changed, 11 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index bef7aec..4c5bc85 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
57 private int frcount = 0; // Used to limit dynamics debug output to 57 private int frcount = 0; // Used to limit dynamics debug output to
58 // every 100th frame 58 // every 100th frame
59 59
60 // private BSScene m_parentScene = null;
61 private BSPrim m_prim; // the prim this dynamic controller belongs to 60 private BSPrim m_prim; // the prim this dynamic controller belongs to
62 61
63 // Vehicle properties 62 // Vehicle properties
@@ -602,7 +601,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
602 } 601 }
603 }//end SetDefaultsForType 602 }//end SetDefaultsForType
604 603
605 internal void Step(float pTimestep, BSScene pParentScene) 604 internal void Step(float pTimestep)
606 { 605 {
607 if (m_type == Vehicle.TYPE_NONE) return; 606 if (m_type == Vehicle.TYPE_NONE) return;
608 607
@@ -610,14 +609,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin
610 if (frcount > 100) 609 if (frcount > 100)
611 frcount = 0; 610 frcount = 0;
612 611
613 MoveLinear(pTimestep, pParentScene); 612 MoveLinear(pTimestep);
614 MoveAngular(pTimestep); 613 MoveAngular(pTimestep);
615 LimitRotation(pTimestep); 614 LimitRotation(pTimestep);
616 DetailLog("{0},step,pos={1},force={2},velocity={3},angvel={4}", 615
616 DetailLog("{0},step,done,pos={1},force={2},velocity={3},angvel={4}",
617 m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity); 617 m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity);
618 }// end Step 618 }// end Step
619 619
620 private void MoveLinear(float pTimestep, BSScene _pParentScene) 620 private void MoveLinear(float pTimestep)
621 { 621 {
622 if (!m_linearMotorDirection.ApproxEquals(Vector3.Zero, 0.01f)) // requested m_linearMotorDirection is significant 622 if (!m_linearMotorDirection.ApproxEquals(Vector3.Zero, 0.01f)) // requested m_linearMotorDirection is significant
623 { 623 {
@@ -664,7 +664,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
664 Vector3 grav = Vector3.Zero; 664 Vector3 grav = Vector3.Zero;
665 // There is some gravity, make a gravity force vector that is applied after object velocity. 665 // There is some gravity, make a gravity force vector that is applied after object velocity.
666 // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g; 666 // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
667 grav.Z = _pParentScene.DefaultGravity.Z * m_prim.Mass * (1f - m_VehicleBuoyancy); 667 grav.Z = m_prim.Scene.DefaultGravity.Z * m_prim.Mass * (1f - m_VehicleBuoyancy);
668 // Preserve the current Z velocity 668 // Preserve the current Z velocity
669 Vector3 vel_now = m_prim.Velocity; 669 Vector3 vel_now = m_prim.Velocity;
670 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity 670 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
@@ -708,9 +708,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
708 m_prim.LocalID, m_BlockingEndPoint, posChange, pos); 708 m_prim.LocalID, m_BlockingEndPoint, posChange, pos);
709 } 709 }
710 } 710 }
711 if (pos.Z < _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y)) 711 if (pos.Z < m_prim.Scene.GetTerrainHeightAtXY(pos.X, pos.Y))
712 { 712 {
713 pos.Z = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + 2; 713 pos.Z = m_prim.Scene.GetTerrainHeightAtXY(pos.X, pos.Y) + 2;
714 m_prim.Position = pos; 714 m_prim.Position = pos;
715 DetailLog("{0},MoveLinear,terrainHeight,pos={1}", m_prim.LocalID, pos); 715 DetailLog("{0},MoveLinear,terrainHeight,pos={1}", m_prim.LocalID, pos);
716 } 716 }
@@ -721,11 +721,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
721 // We should hover, get the target height 721 // We should hover, get the target height
722 if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != 0) 722 if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != 0)
723 { 723 {
724 m_VhoverTargetHeight = _pParentScene.GetWaterLevel() + m_VhoverHeight; 724 m_VhoverTargetHeight = m_prim.Scene.GetWaterLevel() + m_VhoverHeight;
725 } 725 }
726 if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0) 726 if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
727 { 727 {
728 m_VhoverTargetHeight = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight; 728 m_VhoverTargetHeight = m_prim.Scene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight;
729 } 729 }
730 if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0) 730 if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0)
731 { 731 {
@@ -789,7 +789,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
789 { 789 {
790 grav.Z = (float)(grav.Z * 1.125); 790 grav.Z = (float)(grav.Z * 1.125);
791 } 791 }
792 float terraintemp = _pParentScene.GetTerrainHeightAtXYZ(pos); 792 float terraintemp = m_prim.Scene.GetTerrainHeightAtXYZ(pos);
793 float postemp = (pos.Z - terraintemp); 793 float postemp = (pos.Z - terraintemp);
794 if (postemp > 2.5f) 794 if (postemp > 2.5f)
795 { 795 {
@@ -940,7 +940,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
940 DetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", m_prim.LocalID, decayamount, m_lastAngularVelocity); 940 DetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", m_prim.LocalID, decayamount, m_lastAngularVelocity);
941 } //end MoveAngular 941 } //end MoveAngular
942 942
943 } //end MoveAngular
944 internal void LimitRotation(float timestep) 943 internal void LimitRotation(float timestep)
945 { 944 {
946 Quaternion rotq = m_prim.Orientation; 945 Quaternion rotq = m_prim.Orientation;