aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2013-05-06 23:47:19 +0100
committerMelanie2013-05-06 23:47:19 +0100
commitb36e123c7f159b6c97a5ecb03e113c0de8083879 (patch)
tree5aa79fe958adfc44929b25e86c2a72a46dd49422 /OpenSim
parentMerge branch 'master' into careminster (diff)
parentBulletSim: remove friction calcuation from BSMotor and move linear and (diff)
downloadopensim-SC_OLD-b36e123c7f159b6c97a5ecb03e113c0de8083879.zip
opensim-SC_OLD-b36e123c7f159b6c97a5ecb03e113c0de8083879.tar.gz
opensim-SC_OLD-b36e123c7f159b6c97a5ecb03e113c0de8083879.tar.bz2
opensim-SC_OLD-b36e123c7f159b6c97a5ecb03e113c0de8083879.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs17
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs25
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs46
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSMotors.cs63
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs283
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs9
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs4
12 files changed, 186 insertions, 268 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index c2fa1ed..50d8a73 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -161,6 +161,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
161 availableMethods["admin_acl_add"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListAdd); 161 availableMethods["admin_acl_add"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListAdd);
162 availableMethods["admin_acl_remove"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListRemove); 162 availableMethods["admin_acl_remove"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListRemove);
163 availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList); 163 availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
164 availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);
164 165
165 // Misc 166 // Misc
166 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch); 167 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch);
@@ -1903,6 +1904,22 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1903 m_log.Info("[RADMIN]: Access List List Request complete"); 1904 m_log.Info("[RADMIN]: Access List List Request complete");
1904 } 1905 }
1905 1906
1907 private void XmlRpcEstateReload(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1908 {
1909 m_log.Info("[RADMIN]: Received Estate Reload Request");
1910
1911 Hashtable responseData = (Hashtable)response.Value;
1912 Hashtable requestData = (Hashtable)request.Params[0];
1913
1914 m_application.SceneManager.ForEachScene(s =>
1915 s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false)
1916 );
1917
1918 responseData["success"] = true;
1919
1920 m_log.Info("[RADMIN]: Estate Reload Request complete");
1921 }
1922
1906 private void XmlRpcGetAgentsMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 1923 private void XmlRpcGetAgentsMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1907 { 1924 {
1908 Hashtable responseData = (Hashtable)response.Value; 1925 Hashtable responseData = (Hashtable)response.Value;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 4e067b5..ac8c30c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
@@ -118,7 +118,6 @@ public class BSActorAvatarMove : BSActor
118 m_velocityMotor = new BSVMotor("BSCharacter.Velocity", 118 m_velocityMotor = new BSVMotor("BSCharacter.Velocity",
119 0.2f, // time scale 119 0.2f, // time scale
120 BSMotor.Infinite, // decay time scale 120 BSMotor.Infinite, // decay time scale
121 BSMotor.InfiniteVector, // friction timescale
122 1f // efficiency 121 1f // efficiency
123 ); 122 );
124 // _velocityMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages. 123 // _velocityMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs
index 3630ca8..8a79809 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs
@@ -102,7 +102,6 @@ public class BSActorHover : BSActor
102 m_hoverMotor = new BSFMotor("BSActorHover", 102 m_hoverMotor = new BSFMotor("BSActorHover",
103 m_controllingPrim.HoverTau, // timeScale 103 m_controllingPrim.HoverTau, // timeScale
104 BSMotor.Infinite, // decay time scale 104 BSMotor.Infinite, // decay time scale
105 BSMotor.Infinite, // friction timescale
106 1f // efficiency 105 1f // efficiency
107 ); 106 );
108 m_hoverMotor.SetTarget(ComputeCurrentHoverHeight()); 107 m_hoverMotor.SetTarget(ComputeCurrentHoverHeight());
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
index 7801d8e..8b0fdeb 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
@@ -64,9 +64,9 @@ public class BSActorLockAxis : BSActor
64 public override void Refresh() 64 public override void Refresh()
65 { 65 {
66 m_physicsScene.DetailLog("{0},BSActorLockAxis,refresh,lockedAxis={1},enabled={2},pActive={3}", 66 m_physicsScene.DetailLog("{0},BSActorLockAxis,refresh,lockedAxis={1},enabled={2},pActive={3}",
67 m_controllingPrim.LocalID, m_controllingPrim.LockedAxis, Enabled, m_controllingPrim.IsPhysicallyActive); 67 m_controllingPrim.LocalID, m_controllingPrim.LockedAngularAxis, Enabled, m_controllingPrim.IsPhysicallyActive);
68 // If all the axis are free, we don't need to exist 68 // If all the axis are free, we don't need to exist
69 if (m_controllingPrim.LockedAxis == m_controllingPrim.LockedAxisFree) 69 if (m_controllingPrim.LockedAngularAxis == m_controllingPrim.LockedAxisFree)
70 { 70 {
71 Enabled = false; 71 Enabled = false;
72 } 72 }
@@ -123,23 +123,38 @@ public class BSActorLockAxis : BSActor
123 // Free to move linearly in the region 123 // Free to move linearly in the region
124 OMV.Vector3 linearLow = OMV.Vector3.Zero; 124 OMV.Vector3 linearLow = OMV.Vector3.Zero;
125 OMV.Vector3 linearHigh = m_physicsScene.TerrainManager.DefaultRegionSize; 125 OMV.Vector3 linearHigh = m_physicsScene.TerrainManager.DefaultRegionSize;
126 if (m_controllingPrim.LockedLinearAxis.X != BSPhysObject.FreeAxis)
127 {
128 linearLow.X = m_controllingPrim.RawPosition.X;
129 linearHigh.X = m_controllingPrim.RawPosition.X;
130 }
131 if (m_controllingPrim.LockedLinearAxis.Y != BSPhysObject.FreeAxis)
132 {
133 linearLow.Y = m_controllingPrim.RawPosition.Y;
134 linearHigh.Y = m_controllingPrim.RawPosition.Y;
135 }
136 if (m_controllingPrim.LockedLinearAxis.Z != BSPhysObject.FreeAxis)
137 {
138 linearLow.Z = m_controllingPrim.RawPosition.Z;
139 linearHigh.Z = m_controllingPrim.RawPosition.Z;
140 }
126 axisConstrainer.SetLinearLimits(linearLow, linearHigh); 141 axisConstrainer.SetLinearLimits(linearLow, linearHigh);
127 142
128 // Angular with some axis locked 143 // Angular with some axis locked
129 float fPI = (float)Math.PI; 144 float fPI = (float)Math.PI;
130 OMV.Vector3 angularLow = new OMV.Vector3(-fPI, -fPI, -fPI); 145 OMV.Vector3 angularLow = new OMV.Vector3(-fPI, -fPI, -fPI);
131 OMV.Vector3 angularHigh = new OMV.Vector3(fPI, fPI, fPI); 146 OMV.Vector3 angularHigh = new OMV.Vector3(fPI, fPI, fPI);
132 if (m_controllingPrim.LockedAxis.X != 1f) 147 if (m_controllingPrim.LockedAngularAxis.X != BSPhysObject.FreeAxis)
133 { 148 {
134 angularLow.X = 0f; 149 angularLow.X = 0f;
135 angularHigh.X = 0f; 150 angularHigh.X = 0f;
136 } 151 }
137 if (m_controllingPrim.LockedAxis.Y != 1f) 152 if (m_controllingPrim.LockedAngularAxis.Y != BSPhysObject.FreeAxis)
138 { 153 {
139 angularLow.Y = 0f; 154 angularLow.Y = 0f;
140 angularHigh.Y = 0f; 155 angularHigh.Y = 0f;
141 } 156 }
142 if (m_controllingPrim.LockedAxis.Z != 1f) 157 if (m_controllingPrim.LockedAngularAxis.Z != BSPhysObject.FreeAxis)
143 { 158 {
144 angularLow.Z = 0f; 159 angularLow.Z = 0f;
145 angularHigh.Z = 0f; 160 angularHigh.Z = 0f;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs
index 1b598fd..75ff24e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs
@@ -105,7 +105,6 @@ public class BSActorMoveToTarget : BSActor
105 m_targetMotor = new BSVMotor("BSActorMoveToTargget.Activate", 105 m_targetMotor = new BSVMotor("BSActorMoveToTargget.Activate",
106 m_controllingPrim.MoveToTargetTau, // timeScale 106 m_controllingPrim.MoveToTargetTau, // timeScale
107 BSMotor.Infinite, // decay time scale 107 BSMotor.Infinite, // decay time scale
108 BSMotor.InfiniteVector, // friction timescale
109 1f // efficiency 108 1f // efficiency
110 ); 109 );
111 m_targetMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG so motor will output detail log messages. 110 m_targetMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG so motor will output detail log messages.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs
index c0f40fd..96fa0b6 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs
@@ -101,7 +101,7 @@ public class BSActorSetForce : BSActor
101 if (m_forceMotor == null) 101 if (m_forceMotor == null)
102 { 102 {
103 // A fake motor that might be used someday 103 // A fake motor that might be used someday
104 m_forceMotor = new BSFMotor("setForce", 1f, 1f, 1f, 1f); 104 m_forceMotor = new BSFMotor("setForce", 1f, 1f, 1f);
105 105
106 m_physicsScene.BeforeStep += Mover; 106 m_physicsScene.BeforeStep += Mover;
107 } 107 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs
index b3806e1..65098e1 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs
@@ -101,7 +101,7 @@ public class BSActorSetTorque : BSActor
101 if (m_torqueMotor == null) 101 if (m_torqueMotor == null)
102 { 102 {
103 // A fake motor that might be used someday 103 // A fake motor that might be used someday
104 m_torqueMotor = new BSFMotor("setTorque", 1f, 1f, 1f, 1f); 104 m_torqueMotor = new BSFMotor("setTorque", 1f, 1f, 1f);
105 105
106 m_physicsScene.BeforeStep += Mover; 106 m_physicsScene.BeforeStep += Mover;
107 } 107 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index c5bee6d..272a162 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
146 enableAngularVerticalAttraction = true; 146 enableAngularVerticalAttraction = true;
147 enableAngularDeflection = false; 147 enableAngularDeflection = false;
148 enableAngularBanking = true; 148 enableAngularBanking = true;
149 if (BSParam.VehicleDebuggingEnabled) 149 if (BSParam.VehicleDebuggingEnable)
150 { 150 {
151 enableAngularVerticalAttraction = true; 151 enableAngularVerticalAttraction = true;
152 enableAngularDeflection = false; 152 enableAngularDeflection = false;
@@ -235,7 +235,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
235 // set all of the components to the same value 235 // set all of the components to the same value
236 case Vehicle.ANGULAR_FRICTION_TIMESCALE: 236 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
237 m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue); 237 m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue);
238 m_angularMotor.FrictionTimescale = m_angularFrictionTimescale;
239 break; 238 break;
240 case Vehicle.ANGULAR_MOTOR_DIRECTION: 239 case Vehicle.ANGULAR_MOTOR_DIRECTION:
241 m_angularMotorDirection = new Vector3(pValue, pValue, pValue); 240 m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
@@ -244,7 +243,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
244 break; 243 break;
245 case Vehicle.LINEAR_FRICTION_TIMESCALE: 244 case Vehicle.LINEAR_FRICTION_TIMESCALE:
246 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); 245 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
247 m_linearMotor.FrictionTimescale = m_linearFrictionTimescale;
248 break; 246 break;
249 case Vehicle.LINEAR_MOTOR_DIRECTION: 247 case Vehicle.LINEAR_MOTOR_DIRECTION:
250 m_linearMotorDirection = new Vector3(pValue, pValue, pValue); 248 m_linearMotorDirection = new Vector3(pValue, pValue, pValue);
@@ -265,7 +263,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
265 { 263 {
266 case Vehicle.ANGULAR_FRICTION_TIMESCALE: 264 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
267 m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); 265 m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
268 m_angularMotor.FrictionTimescale = m_angularFrictionTimescale;
269 break; 266 break;
270 case Vehicle.ANGULAR_MOTOR_DIRECTION: 267 case Vehicle.ANGULAR_MOTOR_DIRECTION:
271 // Limit requested angular speed to 2 rps= 4 pi rads/sec 268 // Limit requested angular speed to 2 rps= 4 pi rads/sec
@@ -278,7 +275,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
278 break; 275 break;
279 case Vehicle.LINEAR_FRICTION_TIMESCALE: 276 case Vehicle.LINEAR_FRICTION_TIMESCALE:
280 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); 277 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
281 m_linearMotor.FrictionTimescale = m_linearFrictionTimescale;
282 break; 278 break;
283 case Vehicle.LINEAR_MOTOR_DIRECTION: 279 case Vehicle.LINEAR_MOTOR_DIRECTION:
284 m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); 280 m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
@@ -559,14 +555,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
559 break; 555 break;
560 } 556 }
561 557
562 m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, 558 m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, m_linearMotorDecayTimescale, 1f);
563 m_linearMotorDecayTimescale, m_linearFrictionTimescale,
564 1f);
565 m_linearMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) 559 m_linearMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
566 560
567 m_angularMotor = new BSVMotor("AngularMotor", m_angularMotorTimescale, 561 m_angularMotor = new BSVMotor("AngularMotor", m_angularMotorTimescale, m_angularMotorDecayTimescale, 1f);
568 m_angularMotorDecayTimescale, m_angularFrictionTimescale,
569 1f);
570 m_angularMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) 562 m_angularMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
571 563
572 /* Not implemented 564 /* Not implemented
@@ -574,7 +566,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
574 BSMotor.Infinite, BSMotor.InfiniteVector, 566 BSMotor.Infinite, BSMotor.InfiniteVector,
575 m_verticalAttractionEfficiency); 567 m_verticalAttractionEfficiency);
576 // Z goes away and we keep X and Y 568 // Z goes away and we keep X and Y
577 m_verticalAttractionMotor.FrictionTimescale = new Vector3(BSMotor.Infinite, BSMotor.Infinite, 0.1f);
578 m_verticalAttractionMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG DEBUG (enables detail logging) 569 m_verticalAttractionMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
579 */ 570 */
580 571
@@ -1050,8 +1041,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1050 // Add this correction to the velocity to make it faster/slower. 1041 // Add this correction to the velocity to make it faster/slower.
1051 VehicleVelocity += linearMotorVelocityW; 1042 VehicleVelocity += linearMotorVelocityW;
1052 1043
1053 VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5}", 1044 // Friction reduces vehicle motion
1054 ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, linearMotorVelocityW, VehicleVelocity); 1045 Vector3 frictionFactor = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep);
1046 VehicleVelocity -= (VehicleVelocity * frictionFactor);
1047
1048 VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}",
1049 ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV,
1050 linearMotorVelocityW, VehicleVelocity, frictionFactor);
1055 } 1051 }
1056 1052
1057 public void ComputeLinearTerrainHeightCorrection(float pTimestep) 1053 public void ComputeLinearTerrainHeightCorrection(float pTimestep)
@@ -1342,6 +1338,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1342 // } 1338 // }
1343 1339
1344 VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; 1340 VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation;
1341
1342 // Reduce any velocity by friction.
1343 Vector3 frictionFactor = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep);
1344 VehicleRotationalVelocity -= (VehicleRotationalVelocity * frictionFactor);
1345
1345 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", ControllingPrim.LocalID, angularMotorContributionV); 1346 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", ControllingPrim.LocalID, angularMotorContributionV);
1346 } 1347 }
1347 1348
@@ -1629,6 +1630,23 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1629 1630
1630 } 1631 }
1631 1632
1633 // Given a friction vector (reduction in seconds) and a timestep, return the factor to reduce
1634 // some value by to apply this friction.
1635 private Vector3 ComputeFrictionFactor(Vector3 friction, float pTimestep)
1636 {
1637 Vector3 frictionFactor = Vector3.Zero;
1638 if (friction != BSMotor.InfiniteVector)
1639 {
1640 // frictionFactor = (Vector3.One / FrictionTimescale) * timeStep;
1641 // Individual friction components can be 'infinite' so compute each separately.
1642 frictionFactor.X = (friction.X == BSMotor.Infinite) ? 0f : (1f / friction.X);
1643 frictionFactor.Y = (friction.Y == BSMotor.Infinite) ? 0f : (1f / friction.Y);
1644 frictionFactor.Z = (friction.Z == BSMotor.Infinite) ? 0f : (1f / friction.Z);
1645 frictionFactor *= pTimestep;
1646 }
1647 return frictionFactor;
1648 }
1649
1632 private float ClampInRange(float low, float val, float high) 1650 private float ClampInRange(float low, float val, float high)
1633 { 1651 {
1634 return Math.Max(low, Math.Min(val, high)); 1652 return Math.Max(low, Math.Min(val, high));
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
index 0128d8d..ef662b5 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
@@ -65,13 +65,11 @@ public abstract class BSMotor
65} 65}
66 66
67// Motor which moves CurrentValue to TargetValue over TimeScale seconds. 67// Motor which moves CurrentValue to TargetValue over TimeScale seconds.
68// The TargetValue decays in TargetValueDecayTimeScale and 68// The TargetValue decays in TargetValueDecayTimeScale.
69// the CurrentValue will be held back by FrictionTimeScale.
70// This motor will "zero itself" over time in that the targetValue will 69// This motor will "zero itself" over time in that the targetValue will
71// decay to zero and the currentValue will follow it to that zero. 70// decay to zero and the currentValue will follow it to that zero.
72// The overall effect is for the returned correction value to go from large 71// The overall effect is for the returned correction value to go from large
73// values (the total difference between current and target minus friction) 72// values to small and eventually zero values.
74// to small and eventually zero values.
75// TimeScale and TargetDelayTimeScale may be 'infinite' which means no decay. 73// TimeScale and TargetDelayTimeScale may be 'infinite' which means no decay.
76 74
77// For instance, if something is moving at speed X and the desired speed is Y, 75// For instance, if something is moving at speed X and the desired speed is Y,
@@ -88,7 +86,6 @@ public class BSVMotor : BSMotor
88 86
89 public virtual float TimeScale { get; set; } 87 public virtual float TimeScale { get; set; }
90 public virtual float TargetValueDecayTimeScale { get; set; } 88 public virtual float TargetValueDecayTimeScale { get; set; }
91 public virtual Vector3 FrictionTimescale { get; set; }
92 public virtual float Efficiency { get; set; } 89 public virtual float Efficiency { get; set; }
93 90
94 public virtual float ErrorZeroThreshold { get; set; } 91 public virtual float ErrorZeroThreshold { get; set; }
@@ -111,16 +108,14 @@ public class BSVMotor : BSMotor
111 { 108 {
112 TimeScale = TargetValueDecayTimeScale = BSMotor.Infinite; 109 TimeScale = TargetValueDecayTimeScale = BSMotor.Infinite;
113 Efficiency = 1f; 110 Efficiency = 1f;
114 FrictionTimescale = BSMotor.InfiniteVector;
115 CurrentValue = TargetValue = Vector3.Zero; 111 CurrentValue = TargetValue = Vector3.Zero;
116 ErrorZeroThreshold = 0.001f; 112 ErrorZeroThreshold = 0.001f;
117 } 113 }
118 public BSVMotor(string useName, float timeScale, float decayTimeScale, Vector3 frictionTimeScale, float efficiency) 114 public BSVMotor(string useName, float timeScale, float decayTimeScale, float efficiency)
119 : this(useName) 115 : this(useName)
120 { 116 {
121 TimeScale = timeScale; 117 TimeScale = timeScale;
122 TargetValueDecayTimeScale = decayTimeScale; 118 TargetValueDecayTimeScale = decayTimeScale;
123 FrictionTimescale = frictionTimeScale;
124 Efficiency = efficiency; 119 Efficiency = efficiency;
125 CurrentValue = TargetValue = Vector3.Zero; 120 CurrentValue = TargetValue = Vector3.Zero;
126 } 121 }
@@ -165,26 +160,11 @@ public class BSVMotor : BSMotor
165 TargetValue *= (1f - decayFactor); 160 TargetValue *= (1f - decayFactor);
166 } 161 }
167 162
168 // The amount we can correct the error is reduced by the friction
169 Vector3 frictionFactor = Vector3.Zero;
170 if (FrictionTimescale != BSMotor.InfiniteVector)
171 {
172 // frictionFactor = (Vector3.One / FrictionTimescale) * timeStep;
173 // Individual friction components can be 'infinite' so compute each separately.
174 frictionFactor.X = (FrictionTimescale.X == BSMotor.Infinite) ? 0f : (1f / FrictionTimescale.X);
175 frictionFactor.Y = (FrictionTimescale.Y == BSMotor.Infinite) ? 0f : (1f / FrictionTimescale.Y);
176 frictionFactor.Z = (FrictionTimescale.Z == BSMotor.Infinite) ? 0f : (1f / FrictionTimescale.Z);
177 frictionFactor *= timeStep;
178 CurrentValue *= (Vector3.One - frictionFactor);
179 }
180
181 MDetailLog("{0}, BSVMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},err={5},corr={6}", 163 MDetailLog("{0}, BSVMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},err={5},corr={6}",
182 BSScene.DetailLogZero, UseName, origCurrVal, origTarget, 164 BSScene.DetailLogZero, UseName, origCurrVal, origTarget,
183 timeStep, error, correction); 165 timeStep, error, correction);
184 MDetailLog("{0}, BSVMotor.Step,nonZero,{1},tgtDecayTS={2},decayFact={3},frictTS={4},frictFact={5},tgt={6},curr={7}", 166 MDetailLog("{0}, BSVMotor.Step,nonZero,{1},tgtDecayTS={2},decayFact={3},tgt={4},curr={5}",
185 BSScene.DetailLogZero, UseName, 167 BSScene.DetailLogZero, UseName, TargetValueDecayTimeScale, decayFactor, TargetValue, CurrentValue);
186 TargetValueDecayTimeScale, decayFactor, FrictionTimescale, frictionFactor,
187 TargetValue, CurrentValue);
188 } 168 }
189 else 169 else
190 { 170 {
@@ -235,9 +215,9 @@ public class BSVMotor : BSMotor
235 // maximum number of outputs to generate. 215 // maximum number of outputs to generate.
236 int maxOutput = 50; 216 int maxOutput = 50;
237 MDetailLog("{0},BSVMotor.Test,{1},===================================== BEGIN Test Output", BSScene.DetailLogZero, UseName); 217 MDetailLog("{0},BSVMotor.Test,{1},===================================== BEGIN Test Output", BSScene.DetailLogZero, UseName);
238 MDetailLog("{0},BSVMotor.Test,{1},timeScale={2},targDlyTS={3},frictTS={4},eff={5},curr={6},tgt={7}", 218 MDetailLog("{0},BSVMotor.Test,{1},timeScale={2},targDlyTS={3},eff={4},curr={5},tgt={6}",
239 BSScene.DetailLogZero, UseName, 219 BSScene.DetailLogZero, UseName,
240 TimeScale, TargetValueDecayTimeScale, FrictionTimescale, Efficiency, 220 TimeScale, TargetValueDecayTimeScale, Efficiency,
241 CurrentValue, TargetValue); 221 CurrentValue, TargetValue);
242 222
243 LastError = BSMotor.InfiniteVector; 223 LastError = BSMotor.InfiniteVector;
@@ -254,8 +234,8 @@ public class BSVMotor : BSMotor
254 234
255 public override string ToString() 235 public override string ToString()
256 { 236 {
257 return String.Format("<{0},curr={1},targ={2},lastErr={3},decayTS={4},frictTS={5}>", 237 return String.Format("<{0},curr={1},targ={2},lastErr={3},decayTS={4}>",
258 UseName, CurrentValue, TargetValue, LastError, TargetValueDecayTimeScale, FrictionTimescale); 238 UseName, CurrentValue, TargetValue, LastError, TargetValueDecayTimeScale);
259 } 239 }
260} 240}
261 241
@@ -265,7 +245,6 @@ public class BSFMotor : BSMotor
265{ 245{
266 public virtual float TimeScale { get; set; } 246 public virtual float TimeScale { get; set; }
267 public virtual float TargetValueDecayTimeScale { get; set; } 247 public virtual float TargetValueDecayTimeScale { get; set; }
268 public virtual float FrictionTimescale { get; set; }
269 public virtual float Efficiency { get; set; } 248 public virtual float Efficiency { get; set; }
270 249
271 public virtual float ErrorZeroThreshold { get; set; } 250 public virtual float ErrorZeroThreshold { get; set; }
@@ -283,12 +262,11 @@ public class BSFMotor : BSMotor
283 return (err >= -ErrorZeroThreshold && err <= ErrorZeroThreshold); 262 return (err >= -ErrorZeroThreshold && err <= ErrorZeroThreshold);
284 } 263 }
285 264
286 public BSFMotor(string useName, float timeScale, float decayTimescale, float friction, float efficiency) 265 public BSFMotor(string useName, float timeScale, float decayTimescale, float efficiency)
287 : base(useName) 266 : base(useName)
288 { 267 {
289 TimeScale = TargetValueDecayTimeScale = BSMotor.Infinite; 268 TimeScale = TargetValueDecayTimeScale = BSMotor.Infinite;
290 Efficiency = 1f; 269 Efficiency = 1f;
291 FrictionTimescale = BSMotor.Infinite;
292 CurrentValue = TargetValue = 0f; 270 CurrentValue = TargetValue = 0f;
293 ErrorZeroThreshold = 0.01f; 271 ErrorZeroThreshold = 0.01f;
294 } 272 }
@@ -331,24 +309,11 @@ public class BSFMotor : BSMotor
331 TargetValue *= (1f - decayFactor); 309 TargetValue *= (1f - decayFactor);
332 } 310 }
333 311
334 // The amount we can correct the error is reduced by the friction
335 float frictionFactor = 0f;
336 if (FrictionTimescale != BSMotor.Infinite)
337 {
338 // frictionFactor = (Vector3.One / FrictionTimescale) * timeStep;
339 // Individual friction components can be 'infinite' so compute each separately.
340 frictionFactor = 1f / FrictionTimescale;
341 frictionFactor *= timeStep;
342 CurrentValue *= (1f - frictionFactor);
343 }
344
345 MDetailLog("{0}, BSFMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},err={5},corr={6}", 312 MDetailLog("{0}, BSFMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},err={5},corr={6}",
346 BSScene.DetailLogZero, UseName, origCurrVal, origTarget, 313 BSScene.DetailLogZero, UseName, origCurrVal, origTarget,
347 timeStep, error, correction); 314 timeStep, error, correction);
348 MDetailLog("{0}, BSFMotor.Step,nonZero,{1},tgtDecayTS={2},decayFact={3},frictTS={4},frictFact={5},tgt={6},curr={7}", 315 MDetailLog("{0}, BSFMotor.Step,nonZero,{1},tgtDecayTS={2},decayFact={3},tgt={4},curr={5}",
349 BSScene.DetailLogZero, UseName, 316 BSScene.DetailLogZero, UseName, TargetValueDecayTimeScale, decayFactor, TargetValue, CurrentValue);
350 TargetValueDecayTimeScale, decayFactor, FrictionTimescale, frictionFactor,
351 TargetValue, CurrentValue);
352 } 317 }
353 else 318 else
354 { 319 {
@@ -390,8 +355,8 @@ public class BSFMotor : BSMotor
390 355
391 public override string ToString() 356 public override string ToString()
392 { 357 {
393 return String.Format("<{0},curr={1},targ={2},lastErr={3},decayTS={4},frictTS={5}>", 358 return String.Format("<{0},curr={1},targ={2},lastErr={3},decayTS={4}>",
394 UseName, CurrentValue, TargetValue, LastError, TargetValueDecayTimeScale, FrictionTimescale); 359 UseName, CurrentValue, TargetValue, LastError, TargetValueDecayTimeScale);
395 } 360 }
396 361
397} 362}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 2ac68e3..3ca7e16 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection;
29using System.Text; 30using System.Text;
30 31
31using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
@@ -144,7 +145,7 @@ public static class BSParam
144 public static Vector3 VehicleAngularFactor { get; private set; } 145 public static Vector3 VehicleAngularFactor { get; private set; }
145 public static float VehicleGroundGravityFudge { get; private set; } 146 public static float VehicleGroundGravityFudge { get; private set; }
146 public static float VehicleAngularBankingTimescaleFudge { get; private set; } 147 public static float VehicleAngularBankingTimescaleFudge { get; private set; }
147 public static bool VehicleDebuggingEnabled { get; private set; } 148 public static bool VehicleDebuggingEnable { get; private set; }
148 149
149 // Convex Hulls 150 // Convex Hulls
150 public static int CSHullMaxDepthSplit { get; private set; } 151 public static int CSHullMaxDepthSplit { get; private set; }
@@ -236,17 +237,41 @@ public static class BSParam
236 getter = pGetter; 237 getter = pGetter;
237 objectSet = pObjSetter; 238 objectSet = pObjSetter;
238 } 239 }
239 /* Wish I could simplify using this definition but CLR doesn't store references so closure around delegates of references won't work 240 // Simple parameter variable where property name is the same as the INI file name
240 * TODO: Maybe use reflection and the name of the variable to create a reference for the getter/setter. 241 // and the value is only a simple get and set.
241 public ParameterDefn(string pName, string pDesc, T pDefault, ref T loc) 242 public ParameterDefn(string pName, string pDesc, T pDefault)
242 : base(pName, pDesc) 243 : base(pName, pDesc)
243 { 244 {
244 defaultValue = pDefault; 245 defaultValue = pDefault;
245 setter = (s, v) => { loc = v; }; 246 setter = (s, v) => { SetValueByName(s, name, v); };
246 getter = (s) => { return loc; }; 247 getter = (s) => { return GetValueByName(s, name); };
247 objectSet = null; 248 objectSet = null;
248 } 249 }
249 */ 250 // Use reflection to find the property named 'pName' in BSParam and assign 'val' to same.
251 private void SetValueByName(BSScene s, string pName, T val)
252 {
253 PropertyInfo prop = typeof(BSParam).GetProperty(pName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
254 if (prop == null)
255 {
256 // This should only be output when someone adds a new INI parameter and misspells the name.
257 s.Logger.ErrorFormat("{0} SetValueByName: did not find '{1}'. Verify specified property name is the same as the given INI parameters name.", LogHeader, pName);
258 }
259 else
260 {
261 prop.SetValue(null, val, null);
262 }
263 }
264 // Use reflection to find the property named 'pName' in BSParam and return the value in same.
265 private T GetValueByName(BSScene s, string pName)
266 {
267 PropertyInfo prop = typeof(BSParam).GetProperty(pName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
268 if (prop == null)
269 {
270 // This should only be output when someone adds a new INI parameter and misspells the name.
271 s.Logger.ErrorFormat("{0} GetValueByName: did not find '{1}'. Verify specified property name is the same as the given INI parameter name.", LogHeader, pName);
272 }
273 return (T)prop.GetValue(null, null);
274 }
250 public override void AssignDefault(BSScene s) 275 public override void AssignDefault(BSScene s)
251 { 276 {
252 setter(s, defaultValue); 277 setter(s, defaultValue);
@@ -336,26 +361,16 @@ public static class BSParam
336 (s) => { return ShouldUseHullsForPhysicalObjects; }, 361 (s) => { return ShouldUseHullsForPhysicalObjects; },
337 (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ), 362 (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ),
338 new ParameterDefn<bool>("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", 363 new ParameterDefn<bool>("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
339 true, 364 true ),
340 (s) => { return ShouldRemoveZeroWidthTriangles; },
341 (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ),
342 new ParameterDefn<bool>("ShouldUseBulletHACD", "If true, use the Bullet version of HACD", 365 new ParameterDefn<bool>("ShouldUseBulletHACD", "If true, use the Bullet version of HACD",
343 false, 366 false ),
344 (s) => { return ShouldUseBulletHACD; },
345 (s,v) => { ShouldUseBulletHACD = v; } ),
346 new ParameterDefn<bool>("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims", 367 new ParameterDefn<bool>("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims",
347 true, 368 true ),
348 (s) => { return ShouldUseSingleConvexHullForPrims; },
349 (s,v) => { ShouldUseSingleConvexHullForPrims = v; } ),
350 369
351 new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 370 new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions",
352 5, 371 5 ),
353 (s) => { return CrossingFailuresBeforeOutOfBounds; },
354 (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ),
355 new ParameterDefn<float>("UpdateVelocityChangeThreshold", "Change in updated velocity required before reporting change to simulator", 372 new ParameterDefn<float>("UpdateVelocityChangeThreshold", "Change in updated velocity required before reporting change to simulator",
356 0.1f, 373 0.1f ),
357 (s) => { return UpdateVelocityChangeThreshold; },
358 (s,v) => { UpdateVelocityChangeThreshold = v; } ),
359 374
360 new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 375 new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
361 32f, 376 32f,
@@ -422,18 +437,12 @@ public static class BSParam
422 (s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ), 437 (s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ),
423 // Density is passed around as 100kg/m3. This scales that to 1kg/m3. 438 // Density is passed around as 100kg/m3. This scales that to 1kg/m3.
424 new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", 439 new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)",
425 0.01f, 440 0.01f ),
426 (s) => { return DensityScaleFactor; },
427 (s,v) => { DensityScaleFactor = v; } ),
428 441
429 new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", 442 new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing",
430 2200f, 443 2200f ),
431 (s) => { return (float)PID_D; },
432 (s,v) => { PID_D = v; } ),
433 new ParameterDefn<float>("PID_P", "Parameteric factor for motion smoothing", 444 new ParameterDefn<float>("PID_P", "Parameteric factor for motion smoothing",
434 900f, 445 900f ),
435 (s) => { return (float)PID_P; },
436 (s,v) => { PID_P = v; } ),
437 446
438 new ParameterDefn<float>("DefaultFriction", "Friction factor used on new objects", 447 new ParameterDefn<float>("DefaultFriction", "Friction factor used on new objects",
439 0.2f, 448 0.2f,
@@ -500,94 +509,50 @@ public static class BSParam
500 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), 509 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ),
501 510
502 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 511 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
503 (float)BSTerrainPhys.TerrainImplementation.Mesh, 512 (float)BSTerrainPhys.TerrainImplementation.Mesh ),
504 (s) => { return TerrainImplementation; },
505 (s,v) => { TerrainImplementation = v; } ),
506 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 513 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" ,
507 2, 514 2 ),
508 (s) => { return TerrainMeshMagnification; },
509 (s,v) => { TerrainMeshMagnification = v; } ),
510 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , 515 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" ,
511 0.3f, 516 0.3f ),
512 (s) => { return TerrainFriction; },
513 (s,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ),
514 new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" , 517 new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" ,
515 0.8f, 518 0.8f ),
516 (s) => { return TerrainHitFraction; },
517 (s,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ),
518 new ParameterDefn<float>("TerrainRestitution", "Bouncyness" , 519 new ParameterDefn<float>("TerrainRestitution", "Bouncyness" ,
519 0f, 520 0f ),
520 (s) => { return TerrainRestitution; },
521 (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ),
522 new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , 521 new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" ,
523 0.0f, 522 0.0f ),
524 (s) => { return TerrainContactProcessingThreshold; },
525 (s,v) => { TerrainContactProcessingThreshold = v; /* TODO: set on real terrain */ } ),
526 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , 523 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" ,
527 0.08f, 524 0.08f ),
528 (s) => { return TerrainCollisionMargin; },
529 (s,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ),
530 525
531 new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 526 new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.",
532 0.2f, 527 0.2f ),
533 (s) => { return AvatarFriction; },
534 (s,v) => { AvatarFriction = v; } ),
535 new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 528 new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
536 0.95f, 529 0.95f ),
537 (s) => { return AvatarStandingFriction; },
538 (s,v) => { AvatarStandingFriction = v; } ),
539 new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", 530 new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run",
540 1.3f, 531 1.3f ),
541 (s) => { return AvatarAlwaysRunFactor; },
542 (s,v) => { AvatarAlwaysRunFactor = v; } ),
543 new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 532 new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.",
544 3.5f, 533 3.5f) ,
545 (s) => { return AvatarDensity; },
546 (s,v) => { AvatarDensity = v; } ),
547 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 534 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
548 0f, 535 0f ),
549 (s) => { return AvatarRestitution; },
550 (s,v) => { AvatarRestitution = v; } ),
551 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 536 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
552 0.6f, 537 0.6f ) ,
553 (s) => { return AvatarCapsuleWidth; },
554 (s,v) => { AvatarCapsuleWidth = v; } ),
555 new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 538 new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule",
556 0.45f, 539 0.45f ),
557 (s) => { return AvatarCapsuleDepth; },
558 (s,v) => { AvatarCapsuleDepth = v; } ),
559 new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", 540 new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar",
560 1.5f, 541 1.5f ),
561 (s) => { return AvatarCapsuleHeight; },
562 (s,v) => { AvatarCapsuleHeight = v; } ),
563 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 542 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
564 0.1f, 543 0.1f ),
565 (s) => { return AvatarContactProcessingThreshold; },
566 (s,v) => { AvatarContactProcessingThreshold = v; } ),
567 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", 544 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
568 1.0f, 545 1.0f ),
569 (s) => { return AvatarBelowGroundUpCorrectionMeters; },
570 (s,v) => { AvatarBelowGroundUpCorrectionMeters = v; } ),
571 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", 546 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction",
572 0.6f, 547 0.6f ) ,
573 (s) => { return AvatarStepHeight; },
574 (s,v) => { AvatarStepHeight = v; } ),
575 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", 548 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)",
576 0.6f, 549 0.6f ),
577 (s) => { return AvatarStepApproachFactor; },
578 (s,v) => { AvatarStepApproachFactor = v; } ),
579 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", 550 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
580 1.0f, 551 1.0f ),
581 (s) => { return AvatarStepForceFactor; },
582 (s,v) => { AvatarStepForceFactor = v; } ),
583 new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", 552 new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step",
584 1.0f, 553 1.0f ),
585 (s) => { return AvatarStepUpCorrectionFactor; },
586 (s,v) => { AvatarStepUpCorrectionFactor = v; } ),
587 new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", 554 new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs",
588 2, 555 2 ),
589 (s) => { return AvatarStepSmoothingSteps; },
590 (s,v) => { AvatarStepSmoothingSteps = v; } ),
591 556
592 new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 557 new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
593 1000.0f, 558 1000.0f,
@@ -598,37 +563,21 @@ public static class BSParam
598 (s) => { return (float)VehicleMaxAngularVelocity; }, 563 (s) => { return (float)VehicleMaxAngularVelocity; },
599 (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), 564 (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ),
600 new ParameterDefn<float>("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 565 new ParameterDefn<float>("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)",
601 0.0f, 566 0.0f ),
602 (s) => { return VehicleAngularDamping; },
603 (s,v) => { VehicleAngularDamping = v; } ),
604 new ParameterDefn<Vector3>("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)", 567 new ParameterDefn<Vector3>("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)",
605 new Vector3(1f, 1f, 1f), 568 new Vector3(1f, 1f, 1f) ),
606 (s) => { return VehicleLinearFactor; },
607 (s,v) => { VehicleLinearFactor = v; } ),
608 new ParameterDefn<Vector3>("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)", 569 new ParameterDefn<Vector3>("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)",
609 new Vector3(1f, 1f, 1f), 570 new Vector3(1f, 1f, 1f) ),
610 (s) => { return VehicleAngularFactor; },
611 (s,v) => { VehicleAngularFactor = v; } ),
612 new ParameterDefn<float>("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", 571 new ParameterDefn<float>("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)",
613 0.0f, 572 0.0f ),
614 (s) => { return VehicleFriction; },
615 (s,v) => { VehicleFriction = v; } ),
616 new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", 573 new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
617 0.0f, 574 0.0f ),
618 (s) => { return VehicleRestitution; },
619 (s,v) => { VehicleRestitution = v; } ),
620 new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", 575 new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
621 0.2f, 576 0.2f ),
622 (s) => { return VehicleGroundGravityFudge; },
623 (s,v) => { VehicleGroundGravityFudge = v; } ),
624 new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", 577 new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.",
625 60.0f, 578 60.0f ),
626 (s) => { return VehicleAngularBankingTimescaleFudge; },
627 (s,v) => { VehicleAngularBankingTimescaleFudge = v; } ),
628 new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging", 579 new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging",
629 false, 580 false ),
630 (s) => { return VehicleDebuggingEnabled; },
631 (s,v) => { VehicleDebuggingEnabled = v; } ),
632 581
633 new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 582 new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
634 0f, 583 0f,
@@ -673,99 +622,53 @@ public static class BSParam
673 (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), 622 (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ),
674 623
675 new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy", 624 new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy",
676 7, 625 7 ),
677 (s) => { return CSHullMaxDepthSplit; },
678 (s,v) => { CSHullMaxDepthSplit = v; } ),
679 new ParameterDefn<int>("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes", 626 new ParameterDefn<int>("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes",
680 2, 627 2 ),
681 (s) => { return CSHullMaxDepthSplitForSimpleShapes; },
682 (s,v) => { CSHullMaxDepthSplitForSimpleShapes = v; } ),
683 new ParameterDefn<float>("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)", 628 new ParameterDefn<float>("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)",
684 5f, 629 5f ),
685 (s) => { return CSHullConcavityThresholdPercent; },
686 (s,v) => { CSHullConcavityThresholdPercent = v; } ),
687 new ParameterDefn<float>("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)", 630 new ParameterDefn<float>("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)",
688 5f, 631 5f ),
689 (s) => { return CSHullVolumeConservationThresholdPercent; },
690 (s,v) => { CSHullVolumeConservationThresholdPercent = v; } ),
691 new ParameterDefn<int>("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.", 632 new ParameterDefn<int>("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.",
692 32, 633 32 ),
693 (s) => { return CSHullMaxVertices; },
694 (s,v) => { CSHullMaxVertices = v; } ),
695 new ParameterDefn<float>("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.", 634 new ParameterDefn<float>("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.",
696 0f, 635 0f ),
697 (s) => { return CSHullMaxSkinWidth; },
698 (s,v) => { CSHullMaxSkinWidth = v; } ),
699 636
700 new ParameterDefn<float>("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull", 637 new ParameterDefn<float>("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull",
701 100f, 638 100f ),
702 (s) => { return BHullMaxVerticesPerHull; },
703 (s,v) => { BHullMaxVerticesPerHull = v; } ),
704 new ParameterDefn<float>("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh", 639 new ParameterDefn<float>("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh",
705 2f, 640 2f ),
706 (s) => { return BHullMinClusters; },
707 (s,v) => { BHullMinClusters = v; } ),
708 new ParameterDefn<float>("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls", 641 new ParameterDefn<float>("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls",
709 2f, 642 0.1f ),
710 (s) => { return BHullCompacityWeight; },
711 (s,v) => { BHullCompacityWeight = v; } ),
712 new ParameterDefn<float>("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull", 643 new ParameterDefn<float>("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull",
713 0.1f, 644 0f ),
714 (s) => { return BHullVolumeWeight; },
715 (s,v) => { BHullVolumeWeight = v; } ),
716 new ParameterDefn<float>("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be", 645 new ParameterDefn<float>("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be",
717 100f, 646 100f ),
718 (s) => { return BHullConcavity; },
719 (s,v) => { BHullConcavity = v; } ),
720 new ParameterDefn<bool>("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors", 647 new ParameterDefn<bool>("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors",
721 false, 648 false ),
722 (s) => { return BHullAddExtraDistPoints; },
723 (s,v) => { BHullAddExtraDistPoints = v; } ),
724 new ParameterDefn<bool>("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls", 649 new ParameterDefn<bool>("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls",
725 false, 650 false ),
726 (s) => { return BHullAddNeighboursDistPoints; },
727 (s,v) => { BHullAddNeighboursDistPoints = v; } ),
728 new ParameterDefn<bool>("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces", 651 new ParameterDefn<bool>("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces",
729 false, 652 false ),
730 (s) => { return BHullAddFacesPoints; },
731 (s,v) => { BHullAddFacesPoints = v; } ),
732 new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", 653 new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin",
733 false, 654 false ),
734 (s) => { return BHullShouldAdjustCollisionMargin; },
735 (s,v) => { BHullShouldAdjustCollisionMargin = v; } ),
736 655
737 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 656 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
738 (float)BSLinkset.LinksetImplementation.Compound, 657 (float)BSLinkset.LinksetImplementation.Compound ),
739 (s) => { return LinksetImplementation; },
740 (s,v) => { LinksetImplementation = v; } ),
741 new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", 658 new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
742 false, 659 false ),
743 (s) => { return LinkConstraintUseFrameOffset; },
744 (s,v) => { LinkConstraintUseFrameOffset = v; } ),
745 new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", 660 new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
746 true, 661 true ),
747 (s) => { return LinkConstraintEnableTransMotor; },
748 (s,v) => { LinkConstraintEnableTransMotor = v; } ),
749 new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", 662 new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints",
750 5.0f, 663 5.0f ),
751 (s) => { return LinkConstraintTransMotorMaxVel; },
752 (s,v) => { LinkConstraintTransMotorMaxVel = v; } ),
753 new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", 664 new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints",
754 0.1f, 665 0.1f ),
755 (s) => { return LinkConstraintTransMotorMaxForce; },
756 (s,v) => { LinkConstraintTransMotorMaxForce = v; } ),
757 new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", 666 new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1",
758 0.1f, 667 0.1f ),
759 (s) => { return LinkConstraintCFM; },
760 (s,v) => { LinkConstraintCFM = v; } ),
761 new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", 668 new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2",
762 0.1f, 669 0.1f ),
763 (s) => { return LinkConstraintERP; },
764 (s,v) => { LinkConstraintERP = v; } ),
765 new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", 670 new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)",
766 40, 671 40 ),
767 (s) => { return LinkConstraintSolverIterations; },
768 (s,v) => { LinkConstraintSolverIterations = v; } ),
769 672
770 new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", 673 new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)",
771 0, 674 0,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index e796804..cca887a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -108,7 +108,8 @@ public abstract class BSPhysObject : PhysicsActor
108 CollisionScore = 0; 108 CollisionScore = 0;
109 109
110 // All axis free. 110 // All axis free.
111 LockedAxis = LockedAxisFree; 111 LockedLinearAxis = LockedAxisFree;
112 LockedAngularAxis = LockedAxisFree;
112 } 113 }
113 114
114 // Tell the object to clean up. 115 // Tell the object to clean up.
@@ -265,8 +266,10 @@ public abstract class BSPhysObject : PhysicsActor
265 // Note this is a displacement from the root's coordinates. Zero means use the root prim as center-of-mass. 266 // Note this is a displacement from the root's coordinates. Zero means use the root prim as center-of-mass.
266 public OMV.Vector3? UserSetCenterOfMassDisplacement { get; set; } 267 public OMV.Vector3? UserSetCenterOfMassDisplacement { get; set; }
267 268
268 public OMV.Vector3 LockedAxis { get; set; } // zero means locked. one means free. 269 public OMV.Vector3 LockedLinearAxis { get; set; } // zero means locked. one means free.
269 public readonly OMV.Vector3 LockedAxisFree = new OMV.Vector3(1f, 1f, 1f); // All axis are free 270 public OMV.Vector3 LockedAngularAxis { get; set; } // zero means locked. one means free.
271 public const float FreeAxis = 1f;
272 public readonly OMV.Vector3 LockedAxisFree = new OMV.Vector3(FreeAxis, FreeAxis, FreeAxis); // All axis are free
270 273
271 // Enable physical actions. Bullet will keep sleeping non-moving physical objects so 274 // Enable physical actions. Bullet will keep sleeping non-moving physical objects so
272 // they need waking up when parameters are changed. 275 // they need waking up when parameters are changed.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index d3f3475..f5b0361 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -256,9 +256,9 @@ public class BSPrim : BSPhysObject
256 if (axis.X != 1) locking.X = 0f; 256 if (axis.X != 1) locking.X = 0f;
257 if (axis.Y != 1) locking.Y = 0f; 257 if (axis.Y != 1) locking.Y = 0f;
258 if (axis.Z != 1) locking.Z = 0f; 258 if (axis.Z != 1) locking.Z = 0f;
259 LockedAxis = locking; 259 LockedAngularAxis = locking;
260 260
261 EnableActor(LockedAxis != LockedAxisFree, LockedAxisActorName, delegate() 261 EnableActor(LockedAngularAxis != LockedAxisFree, LockedAxisActorName, delegate()
262 { 262 {
263 return new BSActorLockAxis(PhysScene, this, LockedAxisActorName); 263 return new BSActorLockAxis(PhysScene, this, LockedAxisActorName);
264 }); 264 });