aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs39
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs14
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSMotors.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt2
5 files changed, 28 insertions, 37 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index ef68471..5887249 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
87 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate 87 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate
88 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate 88 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate
89 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate 89 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
90 private Vector3 m_lastAngularCorrection = Vector3.Zero; 90 private Vector3 m_lastAngularVelocity = Vector3.Zero;
91 private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body 91 private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
92 92
93 //Deflection properties 93 //Deflection properties
@@ -128,7 +128,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
128 // Return 'true' if this vehicle is doing vehicle things 128 // Return 'true' if this vehicle is doing vehicle things
129 public bool IsActive 129 public bool IsActive
130 { 130 {
131 get { return Type != Vehicle.TYPE_NONE; } 131 get { return Type != Vehicle.TYPE_NONE && Prim.IsPhysical; }
132 } 132 }
133 133
134 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) 134 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
@@ -664,6 +664,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
664 // an UpdateProperties event to send the changes up to the simulator. 664 // an UpdateProperties event to send the changes up to the simulator.
665 BulletSimAPI.PushUpdate2(Prim.PhysBody.ptr); 665 BulletSimAPI.PushUpdate2(Prim.PhysBody.ptr);
666 } 666 }
667 m_knownChanged = 0;
667 } 668 }
668 669
669 // Since the computation of terrain height can be a little involved, this routine 670 // Since the computation of terrain height can be a little involved, this routine
@@ -993,11 +994,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
993 public Vector3 ComputeLinearMotorUp(float pTimestep) 994 public Vector3 ComputeLinearMotorUp(float pTimestep)
994 { 995 {
995 Vector3 ret = Vector3.Zero; 996 Vector3 ret = Vector3.Zero;
997 float distanceAboveGround = 0f;
996 998
997 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0) 999 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
998 { 1000 {
999 float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition); 1001 float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition);
1000 float distanceAboveGround = VehiclePosition.Z - targetHeight; 1002 distanceAboveGround = VehiclePosition.Z - targetHeight;
1001 // Not colliding if the vehicle is off the ground 1003 // Not colliding if the vehicle is off the ground
1002 if (!Prim.IsColliding) 1004 if (!Prim.IsColliding)
1003 { 1005 {
@@ -1010,9 +1012,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1010 // has a decay factor. This says this force should 1012 // has a decay factor. This says this force should
1011 // be computed with a motor. 1013 // be computed with a motor.
1012 // TODO: add interaction with banking. 1014 // TODO: add interaction with banking.
1013 VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},colliding={2},ret={3}",
1014 Prim.LocalID, distanceAboveGround, Prim.IsColliding, ret);
1015 } 1015 }
1016 VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},colliding={2},ret={3}",
1017 Prim.LocalID, distanceAboveGround, Prim.IsColliding, ret);
1016 return ret; 1018 return ret;
1017 } 1019 }
1018 1020
@@ -1049,8 +1051,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1049 // ================================================================== 1051 // ==================================================================
1050 m_lastVertAttractor = verticalAttractionContribution; 1052 m_lastVertAttractor = verticalAttractionContribution;
1051 1053
1052 // Sum corrections 1054 m_lastAngularVelocity = angularMotorContribution
1053 m_lastAngularCorrection = angularMotorContribution
1054 + verticalAttractionContribution 1055 + verticalAttractionContribution
1055 + deflectionContribution 1056 + deflectionContribution
1056 + bankingContribution; 1057 + bankingContribution;
@@ -1058,19 +1059,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1058 // ================================================================== 1059 // ==================================================================
1059 // Apply the correction velocity. 1060 // Apply the correction velocity.
1060 // TODO: Should this be applied as an angular force (torque)? 1061 // TODO: Should this be applied as an angular force (torque)?
1061 if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f)) 1062 if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
1062 { 1063 {
1063 // DEBUG DEBUG DEBUG: optionally scale the angular velocity. Debugging SL vs ODE turning functions. 1064 VehicleRotationalVelocity = m_lastAngularVelocity;
1064 Vector3 scaledCorrection = m_lastAngularCorrection;
1065 if (PhysicsScene.VehicleScaleAngularVelocityByTimestep)
1066 scaledCorrection *= pTimestep;
1067 VehicleRotationalVelocity = scaledCorrection;
1068 1065
1069 VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}", 1066 VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5}",
1070 Prim.LocalID, 1067 Prim.LocalID,
1071 angularMotorContribution, verticalAttractionContribution, 1068 angularMotorContribution, verticalAttractionContribution,
1072 bankingContribution, deflectionContribution, 1069 bankingContribution, deflectionContribution,
1073 m_lastAngularCorrection, scaledCorrection 1070 m_lastAngularVelocity
1074 ); 1071 );
1075 } 1072 }
1076 else 1073 else
@@ -1124,18 +1121,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1124 { 1121 {
1125 Vector3 ret = Vector3.Zero; 1122 Vector3 ret = Vector3.Zero;
1126 1123
1127 // If vertical attaction timescale is reasonable and we applied an angular force last time... 1124 // If vertical attaction timescale is reasonable
1128 if (m_verticalAttractionTimescale < m_verticalAttractionCutoff) 1125 if (m_verticalAttractionTimescale < m_verticalAttractionCutoff)
1129 { 1126 {
1130 // Take a vector pointing up and convert it from world to vehicle relative coords. 1127 // Take a vector pointing up and convert it from world to vehicle relative coords.
1131 Vector3 verticalError = Vector3.UnitZ * VehicleOrientation; 1128 Vector3 verticalError = Vector3.UnitZ * VehicleOrientation;
1132 verticalError.Normalize();
1133 1129
1134 // If vertical attraction correction is needed, the vector that was pointing up (UnitZ) 1130 // If vertical attraction correction is needed, the vector that was pointing up (UnitZ)
1135 // is now leaning to one side (rotated around the X axis) and the Y value will 1131 // is now:
1136 // go from zero (nearly straight up) to one (completely to the side) or leaning 1132 // leaning to one side: rotated around the X axis with the Y value going
1137 // front-to-back (rotated around the Y axis) and the value of X will be between 1133 // from zero (nearly straight up) to one (completely to the side)) or
1138 // zero and one. 1134 // leaning front-to-back: rotated around the Y axis with the value of X being between
1135 // zero and one.
1139 // The value of Z is how far the rotation is off with 1 meaning none and 0 being 90 degrees. 1136 // The value of Z is how far the rotation is off with 1 meaning none and 0 being 90 degrees.
1140 1137
1141 // If verticalError.Z is negative, the vehicle is upside down. Add additional push. 1138 // If verticalError.Z is negative, the vehicle is upside down. Add additional push.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 4d4f712..2a7b72c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -94,10 +94,10 @@ public sealed class BSLinksetCompound : BSLinkset
94 } 94 }
95 95
96 // Schedule a refresh to happen after all the other taint processing. 96 // Schedule a refresh to happen after all the other taint processing.
97 private void ScheduleRebuild() 97 private void ScheduleRebuild(BSPhysObject requestor)
98 { 98 {
99 DetailLog("{0},BSLinksetCompound.Refresh,schedulingRefresh,rebuilding={1}", 99 DetailLog("{0},BSLinksetCompound.Refresh,schedulingRefresh,rebuilding={1}",
100 LinksetRoot.LocalID, Rebuilding); 100 requestor.LocalID, Rebuilding);
101 // When rebuilding, it is possible to set properties that would normally require a rebuild. 101 // When rebuilding, it is possible to set properties that would normally require a rebuild.
102 // If already rebuilding, don't request another rebuild. 102 // If already rebuilding, don't request another rebuild.
103 if (!Rebuilding) 103 if (!Rebuilding)
@@ -124,7 +124,7 @@ public sealed class BSLinksetCompound : BSLinkset
124 { 124 {
125 // The root is going dynamic. Make sure mass is properly set. 125 // The root is going dynamic. Make sure mass is properly set.
126 m_mass = ComputeLinksetMass(); 126 m_mass = ComputeLinksetMass();
127 ScheduleRebuild(); 127 ScheduleRebuild(LinksetRoot);
128 } 128 }
129 else 129 else
130 { 130 {
@@ -153,7 +153,7 @@ public sealed class BSLinksetCompound : BSLinkset
153 DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); 153 DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child));
154 if (IsRoot(child)) 154 if (IsRoot(child))
155 { 155 {
156 ScheduleRebuild(); 156 ScheduleRebuild(LinksetRoot);
157 } 157 }
158 else 158 else
159 { 159 {
@@ -182,7 +182,7 @@ public sealed class BSLinksetCompound : BSLinkset
182 && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) 182 && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
183 { 183 {
184 updated.LinksetInfo = null; 184 updated.LinksetInfo = null;
185 ScheduleRebuild(); 185 ScheduleRebuild(updated);
186 } 186 }
187 } 187 }
188 188
@@ -266,7 +266,7 @@ public sealed class BSLinksetCompound : BSLinkset
266 DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); 266 DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
267 267
268 // Rebuild the compound shape with the new child shape included 268 // Rebuild the compound shape with the new child shape included
269 ScheduleRebuild(); 269 ScheduleRebuild(child);
270 } 270 }
271 return; 271 return;
272 } 272 }
@@ -294,7 +294,7 @@ public sealed class BSLinksetCompound : BSLinkset
294 else 294 else
295 { 295 {
296 // Rebuild the compound shape with the child removed 296 // Rebuild the compound shape with the child removed
297 ScheduleRebuild(); 297 ScheduleRebuild(child);
298 } 298 }
299 } 299 }
300 return; 300 return;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
index cf0a9dc..e0faf4e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
@@ -134,8 +134,6 @@ public class BSVMotor : BSMotor
134 Vector3 addAmount = (TargetValue - CurrentValue)/TimeScale * timeStep; 134 Vector3 addAmount = (TargetValue - CurrentValue)/TimeScale * timeStep;
135 CurrentValue += addAmount; 135 CurrentValue += addAmount;
136 136
137 returnCurrent = CurrentValue;
138
139 // The desired value reduces to zero which also reduces the difference with current. 137 // The desired value reduces to zero which also reduces the difference with current.
140 // If the decay time is infinite, don't decay at all. 138 // If the decay time is infinite, don't decay at all.
141 float decayFactor = 0f; 139 float decayFactor = 0f;
@@ -156,6 +154,8 @@ public class BSVMotor : BSMotor
156 CurrentValue *= (Vector3.One - frictionFactor); 154 CurrentValue *= (Vector3.One - frictionFactor);
157 } 155 }
158 156
157 returnCurrent = CurrentValue;
158
159 MDetailLog("{0}, BSVMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},timeScale={5},addAmnt={6},targetDecay={7},decayFact={8},fricTS={9},frictFact={10}", 159 MDetailLog("{0}, BSVMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},timeScale={5},addAmnt={6},targetDecay={7},decayFact={8},fricTS={9},frictFact={10}",
160 BSScene.DetailLogZero, UseName, origCurrVal, origTarget, 160 BSScene.DetailLogZero, UseName, origCurrVal, origTarget,
161 timeStep, TimeScale, addAmount, 161 timeStep, TimeScale, addAmount,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 7b44574..069cb0d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -189,7 +189,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
189 // 'true' of the vehicle code is to log lots of details 189 // 'true' of the vehicle code is to log lots of details
190 public bool VehicleLoggingEnabled { get; private set; } 190 public bool VehicleLoggingEnabled { get; private set; }
191 public bool VehiclePhysicalLoggingEnabled { get; private set; } 191 public bool VehiclePhysicalLoggingEnabled { get; private set; }
192 public bool VehicleScaleAngularVelocityByTimestep { get; private set; }
193 192
194 #region Construction and Initialization 193 #region Construction and Initialization
195 public BSScene(string identifier) 194 public BSScene(string identifier)
@@ -1239,11 +1238,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
1239 (s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); }, 1238 (s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); },
1240 (s) => { return s.m_params[0].vehicleAngularDamping; }, 1239 (s) => { return s.m_params[0].vehicleAngularDamping; },
1241 (s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ), 1240 (s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ),
1242 new ParameterDefn("VehicleScaleAngularVelocityByTimestep", "If true, scale angular turning by timestep",
1243 ConfigurationParameters.numericFalse,
1244 (s,cf,p,v) => { s.VehicleScaleAngularVelocityByTimestep = cf.GetBoolean(p, s.BoolNumeric(v)); },
1245 (s) => { return s.NumericBool(s.VehicleScaleAngularVelocityByTimestep); },
1246 (s,p,l,v) => { s.VehicleScaleAngularVelocityByTimestep = s.BoolNumeric(v); } ),
1247 1241
1248 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 1242 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
1249 0f, 1243 0f,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 31dd790..0d9a156 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -5,7 +5,7 @@ Eliminate all crashes (DONEish)
5 Border crossing of physical linkset (DONE) 5 Border crossing of physical linkset (DONE)
6Enable vehicle border crossings (at least as poorly as ODE) 6Enable vehicle border crossings (at least as poorly as ODE)
7 Avatar created in previous region and not new region when crossing border 7 Avatar created in previous region and not new region when crossing border
8 Vehicle recreated in new sim at small Z value (offset from root value?) 8 Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
9Calibrate turning radius 9Calibrate turning radius
10limitMotorUp calibration (more down?) 10limitMotorUp calibration (more down?)
11study PID motors (include 'efficiency' implementation 11study PID motors (include 'efficiency' implementation