diff options
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 303 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 4 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 2 |
6 files changed, 180 insertions, 155 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 82fe267..0204967 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -125,33 +125,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
125 | static readonly float PIOverFour = ((float)Math.PI) / 4f; | 125 | static readonly float PIOverFour = ((float)Math.PI) / 4f; |
126 | static readonly float PIOverTwo = ((float)Math.PI) / 2f; | 126 | static readonly float PIOverTwo = ((float)Math.PI) / 2f; |
127 | 127 | ||
128 | // For debugging, flags to turn on and off individual corrections. | ||
129 | public bool enableAngularVerticalAttraction; | ||
130 | public bool enableAngularDeflection; | ||
131 | public bool enableAngularBanking; | ||
132 | |||
133 | public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName) | 128 | public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName) |
134 | : base(myScene, myPrim, actorName) | 129 | : base(myScene, myPrim, actorName) |
135 | { | 130 | { |
136 | ControllingPrim = myPrim; | 131 | ControllingPrim = myPrim; |
137 | Type = Vehicle.TYPE_NONE; | 132 | Type = Vehicle.TYPE_NONE; |
138 | m_haveRegisteredForSceneEvents = false; | 133 | m_haveRegisteredForSceneEvents = false; |
139 | SetupVehicleDebugging(); | ||
140 | } | ||
141 | |||
142 | // Stopgap debugging enablement. Allows source level debugging but still checking | ||
143 | // in changes by making enablement of debugging flags from INI file. | ||
144 | public void SetupVehicleDebugging() | ||
145 | { | ||
146 | enableAngularVerticalAttraction = true; | ||
147 | enableAngularDeflection = true; | ||
148 | enableAngularBanking = true; | ||
149 | if (BSParam.VehicleDebuggingEnable) | ||
150 | { | ||
151 | enableAngularVerticalAttraction = true; | ||
152 | enableAngularDeflection = false; | ||
153 | enableAngularBanking = false; | ||
154 | } | ||
155 | } | 134 | } |
156 | 135 | ||
157 | // Return 'true' if this vehicle is doing vehicle things | 136 | // Return 'true' if this vehicle is doing vehicle things |
@@ -556,10 +535,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
556 | } | 535 | } |
557 | 536 | ||
558 | m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, m_linearMotorDecayTimescale, 1f); | 537 | m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, m_linearMotorDecayTimescale, 1f); |
559 | m_linearMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) | 538 | // m_linearMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) |
560 | 539 | ||
561 | m_angularMotor = new BSVMotor("AngularMotor", m_angularMotorTimescale, m_angularMotorDecayTimescale, 1f); | 540 | m_angularMotor = new BSVMotor("AngularMotor", m_angularMotorTimescale, m_angularMotorDecayTimescale, 1f); |
562 | m_angularMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) | 541 | // m_angularMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) |
563 | 542 | ||
564 | /* Not implemented | 543 | /* Not implemented |
565 | m_verticalAttractionMotor = new BSVMotor("VerticalAttraction", m_verticalAttractionTimescale, | 544 | m_verticalAttractionMotor = new BSVMotor("VerticalAttraction", m_verticalAttractionTimescale, |
@@ -926,6 +905,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
926 | return VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); | 905 | return VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); |
927 | } | 906 | } |
928 | } | 907 | } |
908 | |||
929 | private float VehicleForwardSpeed | 909 | private float VehicleForwardSpeed |
930 | { | 910 | { |
931 | get | 911 | get |
@@ -1061,26 +1041,37 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1061 | Vector3 linearDeflectionV = Vector3.Zero; | 1041 | Vector3 linearDeflectionV = Vector3.Zero; |
1062 | Vector3 velocityV = VehicleForwardVelocity; | 1042 | Vector3 velocityV = VehicleForwardVelocity; |
1063 | 1043 | ||
1064 | // Velocity in Y and Z dimensions is movement to the side or turning. | 1044 | if (BSParam.VehicleEnableLinearDeflection) |
1065 | // Compute deflection factor from the to the side and rotational velocity | 1045 | { |
1066 | linearDeflectionV.Y = SortedClampInRange(0, (velocityV.Y * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Y); | 1046 | // Velocity in Y and Z dimensions is movement to the side or turning. |
1067 | linearDeflectionV.Z = SortedClampInRange(0, (velocityV.Z * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Z); | 1047 | // Compute deflection factor from the to the side and rotational velocity |
1048 | linearDeflectionV.Y = SortedClampInRange(0, (velocityV.Y * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Y); | ||
1049 | linearDeflectionV.Z = SortedClampInRange(0, (velocityV.Z * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Z); | ||
1050 | |||
1051 | // Velocity to the side and around is corrected and moved into the forward direction | ||
1052 | linearDeflectionV.X += Math.Abs(linearDeflectionV.Y); | ||
1053 | linearDeflectionV.X += Math.Abs(linearDeflectionV.Z); | ||
1068 | 1054 | ||
1069 | // Velocity to the side and around is corrected and moved into the forward direction | 1055 | // Scale the deflection to the fractional simulation time |
1070 | linearDeflectionV.X += Math.Abs(linearDeflectionV.Y); | 1056 | linearDeflectionV *= pTimestep; |
1071 | linearDeflectionV.X += Math.Abs(linearDeflectionV.Z); | ||
1072 | 1057 | ||
1073 | // Scale the deflection to the fractional simulation time | 1058 | // Subtract the sideways and rotational velocity deflection factors while adding the correction forward |
1074 | linearDeflectionV *= pTimestep; | 1059 | linearDeflectionV *= new Vector3(1, -1, -1); |
1075 | 1060 | ||
1076 | // Subtract the sideways and rotational velocity deflection factors while adding the correction forward | 1061 | // Correction is vehicle relative. Convert to world coordinates. |
1077 | linearDeflectionV *= new Vector3(1,-1,-1); | 1062 | Vector3 linearDeflectionW = linearDeflectionV * VehicleOrientation; |
1078 | 1063 | ||
1079 | // Correciont is vehicle relative. Convert to world coordinates and add to the velocity | 1064 | // Optionally, if not colliding, don't effect world downward velocity. Let falling things fall. |
1080 | VehicleVelocity += linearDeflectionV * VehicleOrientation; | 1065 | if (BSParam.VehicleLinearDeflectionNotCollidingNoZ && !m_controllingPrim.IsColliding) |
1066 | { | ||
1067 | linearDeflectionW.Z = 0f; | ||
1068 | } | ||
1081 | 1069 | ||
1082 | VDetailLog("{0}, MoveLinear,LinearDeflection,linDefEff={1},linDefTS={2},linDeflectionV={3}", | 1070 | VehicleVelocity += linearDeflectionW; |
1083 | ControllingPrim.LocalID, m_linearDeflectionEfficiency, m_linearDeflectionTimescale, linearDeflectionV); | 1071 | |
1072 | VDetailLog("{0}, MoveLinear,LinearDeflection,linDefEff={1},linDefTS={2},linDeflectionV={3}", | ||
1073 | ControllingPrim.LocalID, m_linearDeflectionEfficiency, m_linearDeflectionTimescale, linearDeflectionV); | ||
1074 | } | ||
1084 | } | 1075 | } |
1085 | 1076 | ||
1086 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) | 1077 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) |
@@ -1393,116 +1384,134 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1393 | { | 1384 | { |
1394 | 1385 | ||
1395 | // If vertical attaction timescale is reasonable | 1386 | // If vertical attaction timescale is reasonable |
1396 | if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) | 1387 | if (BSParam.VehicleEnableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) |
1397 | { | 1388 | { |
1398 | //Another formula to try got from : | 1389 | Vector3 vehicleUpAxis = Vector3.UnitZ * VehicleOrientation; |
1399 | //http://answers.unity3d.com/questions/10425/how-to-stabilize-angular-motion-alignment-of-hover.html | 1390 | switch (BSParam.VehicleAngularVerticalAttractionAlgorithm) |
1400 | |||
1401 | Vector3 VehicleUpAxis = Vector3.UnitZ * VehicleOrientation; | ||
1402 | |||
1403 | // Flipping what was originally a timescale into a speed variable and then multiplying it by 2 | ||
1404 | // since only computing half the distance between the angles. | ||
1405 | float VerticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f; | ||
1406 | |||
1407 | // Make a prediction of where the up axis will be when this is applied rather then where it is now as | ||
1408 | // this makes for a smoother adjustment and less fighting between the various forces. | ||
1409 | Vector3 predictedUp = VehicleUpAxis * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f); | ||
1410 | |||
1411 | // This is only half the distance to the target so it will take 2 seconds to complete the turn. | ||
1412 | Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); | ||
1413 | |||
1414 | // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared | ||
1415 | Vector3 vertContributionV = torqueVector * VerticalAttractionSpeed * VerticalAttractionSpeed; | ||
1416 | |||
1417 | VehicleRotationalVelocity += vertContributionV; | ||
1418 | |||
1419 | VDetailLog("{0}, MoveAngular,verticalAttraction,UpAxis={1},PredictedUp={2},torqueVector={3},contrib={4}", | ||
1420 | ControllingPrim.LocalID, | ||
1421 | VehicleUpAxis, | ||
1422 | predictedUp, | ||
1423 | torqueVector, | ||
1424 | vertContributionV); | ||
1425 | //===================================================================== | ||
1426 | /* | ||
1427 | // Possible solution derived from a discussion at: | ||
1428 | // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no | ||
1429 | |||
1430 | // Create a rotation that is only the vehicle's rotation around Z | ||
1431 | Vector3 currentEuler = Vector3.Zero; | ||
1432 | VehicleOrientation.GetEulerAngles(out currentEuler.X, out currentEuler.Y, out currentEuler.Z); | ||
1433 | Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEuler.Z); | ||
1434 | |||
1435 | // Create the axis that is perpendicular to the up vector and the rotated up vector. | ||
1436 | Vector3 differenceAxis = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation); | ||
1437 | // Compute the angle between those to vectors. | ||
1438 | double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation))); | ||
1439 | // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical | ||
1440 | |||
1441 | // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied. | ||
1442 | // TODO: add 'efficiency'. | ||
1443 | differenceAngle /= m_verticalAttractionTimescale; | ||
1444 | |||
1445 | // Create the quaterian representing the correction angle | ||
1446 | Quaternion correctionRotation = Quaternion.CreateFromAxisAngle(differenceAxis, (float)differenceAngle); | ||
1447 | |||
1448 | // Turn that quaternion into Euler values to make it into velocities to apply. | ||
1449 | Vector3 vertContributionV = Vector3.Zero; | ||
1450 | correctionRotation.GetEulerAngles(out vertContributionV.X, out vertContributionV.Y, out vertContributionV.Z); | ||
1451 | vertContributionV *= -1f; | ||
1452 | |||
1453 | VehicleRotationalVelocity += vertContributionV; | ||
1454 | |||
1455 | VDetailLog("{0}, MoveAngular,verticalAttraction,diffAxis={1},diffAng={2},corrRot={3},contrib={4}", | ||
1456 | ControllingPrim.LocalID, | ||
1457 | differenceAxis, | ||
1458 | differenceAngle, | ||
1459 | correctionRotation, | ||
1460 | vertContributionV); | ||
1461 | */ | ||
1462 | |||
1463 | // =================================================================== | ||
1464 | /* | ||
1465 | Vector3 vertContributionV = Vector3.Zero; | ||
1466 | Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG | ||
1467 | |||
1468 | // Take a vector pointing up and convert it from world to vehicle relative coords. | ||
1469 | Vector3 verticalError = Vector3.Normalize(Vector3.UnitZ * VehicleOrientation); | ||
1470 | |||
1471 | // If vertical attraction correction is needed, the vector that was pointing up (UnitZ) | ||
1472 | // is now: | ||
1473 | // leaning to one side: rotated around the X axis with the Y value going | ||
1474 | // from zero (nearly straight up) to one (completely to the side)) or | ||
1475 | // leaning front-to-back: rotated around the Y axis with the value of X being between | ||
1476 | // zero and one. | ||
1477 | // The value of Z is how far the rotation is off with 1 meaning none and 0 being 90 degrees. | ||
1478 | |||
1479 | // Y error means needed rotation around X axis and visa versa. | ||
1480 | // Since the error goes from zero to one, the asin is the corresponding angle. | ||
1481 | vertContributionV.X = (float)Math.Asin(verticalError.Y); | ||
1482 | // (Tilt forward (positive X) needs to tilt back (rotate negative) around Y axis.) | ||
1483 | vertContributionV.Y = -(float)Math.Asin(verticalError.X); | ||
1484 | |||
1485 | // If verticalError.Z is negative, the vehicle is upside down. Add additional push. | ||
1486 | if (verticalError.Z < 0f) | ||
1487 | { | 1391 | { |
1488 | vertContributionV.X += Math.Sign(vertContributionV.X) * PIOverFour; | 1392 | case 0: |
1489 | // vertContribution.Y -= PIOverFour; | 1393 | { |
1394 | //Another formula to try got from : | ||
1395 | //http://answers.unity3d.com/questions/10425/how-to-stabilize-angular-motion-alignment-of-hover.html | ||
1396 | |||
1397 | // Flipping what was originally a timescale into a speed variable and then multiplying it by 2 | ||
1398 | // since only computing half the distance between the angles. | ||
1399 | float VerticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f; | ||
1400 | |||
1401 | // Make a prediction of where the up axis will be when this is applied rather then where it is now as | ||
1402 | // this makes for a smoother adjustment and less fighting between the various forces. | ||
1403 | Vector3 predictedUp = vehicleUpAxis * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f); | ||
1404 | |||
1405 | // This is only half the distance to the target so it will take 2 seconds to complete the turn. | ||
1406 | Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); | ||
1407 | |||
1408 | // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared | ||
1409 | Vector3 vertContributionV = torqueVector * VerticalAttractionSpeed * VerticalAttractionSpeed; | ||
1410 | |||
1411 | VehicleRotationalVelocity += vertContributionV; | ||
1412 | |||
1413 | VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},PredictedUp={2},torqueVector={3},contrib={4}", | ||
1414 | ControllingPrim.LocalID, | ||
1415 | vehicleUpAxis, | ||
1416 | predictedUp, | ||
1417 | torqueVector, | ||
1418 | vertContributionV); | ||
1419 | break; | ||
1420 | } | ||
1421 | case 1: | ||
1422 | { | ||
1423 | // Possible solution derived from a discussion at: | ||
1424 | // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no | ||
1425 | |||
1426 | // Create a rotation that is only the vehicle's rotation around Z | ||
1427 | Vector3 currentEuler = Vector3.Zero; | ||
1428 | VehicleOrientation.GetEulerAngles(out currentEuler.X, out currentEuler.Y, out currentEuler.Z); | ||
1429 | Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEuler.Z); | ||
1430 | |||
1431 | // Create the axis that is perpendicular to the up vector and the rotated up vector. | ||
1432 | Vector3 differenceAxis = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation); | ||
1433 | // Compute the angle between those to vectors. | ||
1434 | double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation))); | ||
1435 | // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical | ||
1436 | |||
1437 | // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied. | ||
1438 | // TODO: add 'efficiency'. | ||
1439 | differenceAngle /= m_verticalAttractionTimescale; | ||
1440 | |||
1441 | // Create the quaterian representing the correction angle | ||
1442 | Quaternion correctionRotation = Quaternion.CreateFromAxisAngle(differenceAxis, (float)differenceAngle); | ||
1443 | |||
1444 | // Turn that quaternion into Euler values to make it into velocities to apply. | ||
1445 | Vector3 vertContributionV = Vector3.Zero; | ||
1446 | correctionRotation.GetEulerAngles(out vertContributionV.X, out vertContributionV.Y, out vertContributionV.Z); | ||
1447 | vertContributionV *= -1f; | ||
1448 | |||
1449 | VehicleRotationalVelocity += vertContributionV; | ||
1450 | |||
1451 | VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},diffAxis={2},diffAng={3},corrRot={4},contrib={5}", | ||
1452 | ControllingPrim.LocalID, | ||
1453 | vehicleUpAxis, | ||
1454 | differenceAxis, | ||
1455 | differenceAngle, | ||
1456 | correctionRotation, | ||
1457 | vertContributionV); | ||
1458 | break; | ||
1459 | } | ||
1460 | case 2: | ||
1461 | { | ||
1462 | Vector3 vertContributionV = Vector3.Zero; | ||
1463 | Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG | ||
1464 | |||
1465 | // Take a vector pointing up and convert it from world to vehicle relative coords. | ||
1466 | Vector3 verticalError = Vector3.Normalize(Vector3.UnitZ * VehicleOrientation); | ||
1467 | |||
1468 | // If vertical attraction correction is needed, the vector that was pointing up (UnitZ) | ||
1469 | // is now: | ||
1470 | // leaning to one side: rotated around the X axis with the Y value going | ||
1471 | // from zero (nearly straight up) to one (completely to the side)) or | ||
1472 | // leaning front-to-back: rotated around the Y axis with the value of X being between | ||
1473 | // zero and one. | ||
1474 | // The value of Z is how far the rotation is off with 1 meaning none and 0 being 90 degrees. | ||
1475 | |||
1476 | // Y error means needed rotation around X axis and visa versa. | ||
1477 | // Since the error goes from zero to one, the asin is the corresponding angle. | ||
1478 | vertContributionV.X = (float)Math.Asin(verticalError.Y); | ||
1479 | // (Tilt forward (positive X) needs to tilt back (rotate negative) around Y axis.) | ||
1480 | vertContributionV.Y = -(float)Math.Asin(verticalError.X); | ||
1481 | |||
1482 | // If verticalError.Z is negative, the vehicle is upside down. Add additional push. | ||
1483 | if (verticalError.Z < 0f) | ||
1484 | { | ||
1485 | vertContributionV.X += Math.Sign(vertContributionV.X) * PIOverFour; | ||
1486 | // vertContribution.Y -= PIOverFour; | ||
1487 | } | ||
1488 | |||
1489 | // 'vertContrbution' is now the necessary angular correction to correct tilt in one second. | ||
1490 | // Correction happens over a number of seconds. | ||
1491 | Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG | ||
1492 | |||
1493 | // The correction happens over the user's time period | ||
1494 | vertContributionV /= m_verticalAttractionTimescale; | ||
1495 | |||
1496 | // Rotate the vehicle rotation to the world coordinates. | ||
1497 | VehicleRotationalVelocity += (vertContributionV * VehicleOrientation); | ||
1498 | |||
1499 | VDetailLog("{0}, MoveAngular,verticalAttraction,,upAxis={1},origRotVW={2},vertError={3},unscaledV={4},eff={5},ts={6},vertContribV={7}", | ||
1500 | ControllingPrim.LocalID, | ||
1501 | vehicleUpAxis, | ||
1502 | origRotVelW, | ||
1503 | verticalError, | ||
1504 | unscaledContribVerticalErrorV, | ||
1505 | m_verticalAttractionEfficiency, | ||
1506 | m_verticalAttractionTimescale, | ||
1507 | vertContributionV); | ||
1508 | break; | ||
1509 | } | ||
1510 | default: | ||
1511 | { | ||
1512 | break; | ||
1513 | } | ||
1490 | } | 1514 | } |
1491 | |||
1492 | // 'vertContrbution' is now the necessary angular correction to correct tilt in one second. | ||
1493 | // Correction happens over a number of seconds. | ||
1494 | Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG | ||
1495 | |||
1496 | // The correction happens over the user's time period | ||
1497 | vertContributionV /= m_verticalAttractionTimescale; | ||
1498 | |||
1499 | // Rotate the vehicle rotation to the world coordinates. | ||
1500 | VehicleRotationalVelocity += (vertContributionV * VehicleOrientation); | ||
1501 | |||
1502 | VDetailLog("{0}, MoveAngular,verticalAttraction,,origRotVW={1},vertError={2},unscaledV={3},eff={4},ts={5},vertContribV={6}", | ||
1503 | Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV, | ||
1504 | m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV); | ||
1505 | */ | ||
1506 | } | 1515 | } |
1507 | } | 1516 | } |
1508 | 1517 | ||
@@ -1514,7 +1523,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1514 | public void ComputeAngularDeflection() | 1523 | public void ComputeAngularDeflection() |
1515 | { | 1524 | { |
1516 | 1525 | ||
1517 | if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2) | 1526 | if (BSParam.VehicleEnableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2) |
1518 | { | 1527 | { |
1519 | Vector3 deflectContributionV = Vector3.Zero; | 1528 | Vector3 deflectContributionV = Vector3.Zero; |
1520 | 1529 | ||
@@ -1593,7 +1602,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1593 | // make a sluggish vehicle by giving it a timescale of several seconds. | 1602 | // make a sluggish vehicle by giving it a timescale of several seconds. |
1594 | public void ComputeAngularBanking() | 1603 | public void ComputeAngularBanking() |
1595 | { | 1604 | { |
1596 | if (enableAngularBanking && m_bankingEfficiency != 0 && m_verticalAttractionTimescale < m_verticalAttractionCutoff) | 1605 | if (BSParam.VehicleEnableAngularBanking && m_bankingEfficiency != 0 && m_verticalAttractionTimescale < m_verticalAttractionCutoff) |
1597 | { | 1606 | { |
1598 | Vector3 bankingContributionV = Vector3.Zero; | 1607 | Vector3 bankingContributionV = Vector3.Zero; |
1599 | 1608 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 0f84bf7..dcf1e83 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -155,7 +155,12 @@ public static class BSParam | |||
155 | public static Vector3 VehicleInertiaFactor { get; private set; } | 155 | public static Vector3 VehicleInertiaFactor { get; private set; } |
156 | public static float VehicleGroundGravityFudge { get; private set; } | 156 | public static float VehicleGroundGravityFudge { get; private set; } |
157 | public static float VehicleAngularBankingTimescaleFudge { get; private set; } | 157 | public static float VehicleAngularBankingTimescaleFudge { get; private set; } |
158 | public static bool VehicleDebuggingEnable { get; private set; } | 158 | public static bool VehicleEnableLinearDeflection { get; private set; } |
159 | public static bool VehicleLinearDeflectionNotCollidingNoZ { get; private set; } | ||
160 | public static bool VehicleEnableAngularVerticalAttraction { get; private set; } | ||
161 | public static int VehicleAngularVerticalAttractionAlgorithm { get; private set; } | ||
162 | public static bool VehicleEnableAngularDeflection { get; private set; } | ||
163 | public static bool VehicleEnableAngularBanking { get; private set; } | ||
159 | 164 | ||
160 | // Convex Hulls | 165 | // Convex Hulls |
161 | public static int CSHullMaxDepthSplit { get; private set; } | 166 | public static int CSHullMaxDepthSplit { get; private set; } |
@@ -606,8 +611,18 @@ public static class BSParam | |||
606 | 0.2f ), | 611 | 0.2f ), |
607 | new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", | 612 | new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", |
608 | 60.0f ), | 613 | 60.0f ), |
609 | new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging", | 614 | new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", |
610 | false ), | 615 | true ), |
616 | new ParameterDefn<bool>("VehicleLinearDeflectionNotCollidingNoZ", "Turn on/off linear deflection Z effect on non-colliding vehicles", | ||
617 | true ), | ||
618 | new ParameterDefn<bool>("VehicleEnableAngularVerticalAttraction", "Turn on/off vehicle angular vertical attraction effect", | ||
619 | true ), | ||
620 | new ParameterDefn<int>("VehicleAngularVerticalAttractionAlgorithm", "Select vertical attraction algo. You need to look at the source.", | ||
621 | 0 ), | ||
622 | new ParameterDefn<bool>("VehicleEnableAngularDeflection", "Turn on/off vehicle angular deflection effect", | ||
623 | true ), | ||
624 | new ParameterDefn<bool>("VehicleEnableAngularBanking", "Turn on/off vehicle angular banking effect", | ||
625 | true ), | ||
611 | 626 | ||
612 | new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", | 627 | new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", |
613 | 0f, | 628 | 0f, |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index e56a6f6..214271b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -648,7 +648,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
648 | simTime = Util.EnvironmentTickCountSubtract(beforeTime); | 648 | simTime = Util.EnvironmentTickCountSubtract(beforeTime); |
649 | if (PhysicsLogging.Enabled) | 649 | if (PhysicsLogging.Enabled) |
650 | { | 650 | { |
651 | DetailLog("{0},DoPhysicsStep,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}", | 651 | DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}", |
652 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, | 652 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, |
653 | updatedEntityCount, collidersCount, ObjectsWithCollisions.Count); | 653 | updatedEntityCount, collidersCount, ObjectsWithCollisions.Count); |
654 | } | 654 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs index 583c436..48d3742 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs | |||
@@ -57,6 +57,8 @@ public class BasicVehicles : OpenSimTestCase | |||
57 | public void Init() | 57 | public void Init() |
58 | { | 58 | { |
59 | Dictionary<string, string> engineParams = new Dictionary<string, string>(); | 59 | Dictionary<string, string> engineParams = new Dictionary<string, string>(); |
60 | engineParams.Add("VehicleEnableAngularVerticalAttraction", "true"); | ||
61 | engineParams.Add("VehicleAngularVerticalAttractionAlgorithm", "1"); | ||
60 | PhysicsScene = BulletSimTestsUtil.CreateBasicPhysicsEngine(engineParams); | 62 | PhysicsScene = BulletSimTestsUtil.CreateBasicPhysicsEngine(engineParams); |
61 | 63 | ||
62 | PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateSphere(); | 64 | PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateSphere(); |
@@ -119,7 +121,7 @@ public class BasicVehicles : OpenSimTestCase | |||
119 | { | 121 | { |
120 | vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency); | 122 | vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency); |
121 | vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale); | 123 | vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale); |
122 | vehicleActor.enableAngularVerticalAttraction = true; | 124 | // vehicleActor.enableAngularVerticalAttraction = true; |
123 | 125 | ||
124 | TestVehicle.IsPhysical = true; | 126 | TestVehicle.IsPhysical = true; |
125 | PhysicsScene.ProcessTaints(); | 127 | PhysicsScene.ProcessTaints(); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 0d66496..13c69d6 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -108,7 +108,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
108 | private Vector3 m_taintAngularLock = Vector3.One; | 108 | private Vector3 m_taintAngularLock = Vector3.One; |
109 | private IntPtr Amotor = IntPtr.Zero; | 109 | private IntPtr Amotor = IntPtr.Zero; |
110 | 110 | ||
111 | private object m_assetsLock = new object(); | ||
112 | private bool m_assetFailed = false; | 111 | private bool m_assetFailed = false; |
113 | 112 | ||
114 | private Vector3 m_PIDTarget; | 113 | private Vector3 m_PIDTarget; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 07663b3..7e652fc 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
46 | /// </summary> | 46 | /// </summary> |
47 | public class OdePlugin : IPhysicsPlugin | 47 | public class OdePlugin : IPhysicsPlugin |
48 | { | 48 | { |
49 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 49 | // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private OdeScene m_scene; | 51 | private OdeScene m_scene; |
52 | 52 | ||