Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

This commit is contained in:
Melanie
2013-03-17 23:07:12 +00:00
29 changed files with 157 additions and 8909 deletions

View File

@@ -143,7 +143,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{
enableAngularVerticalAttraction = true;
enableAngularDeflection = false;
enableAngularBanking = false;
enableAngularBanking = true;
if (BSParam.VehicleDebuggingEnabled)
{
enableAngularVerticalAttraction = true;
@@ -1280,11 +1280,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// That is, NO_DEFLECTION_UP says angular motion should not add any pitch or roll movement
// TODO: This is here because this is where ODE put it but documentation says it
// is a linear effect. Where should this check go?
if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0)
{
angularMotorContributionV.X = 0f;
angularMotorContributionV.Y = 0f;
}
//if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0)
// {
// angularMotorContributionV.X = 0f;
// angularMotorContributionV.Y = 0f;
// }
VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation;
VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", Prim.LocalID, angularMotorContributionV);
@@ -1437,24 +1437,25 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// As the vehicle rolls to the right or left, the Y value will increase from
// zero (straight up) to 1 or -1 (full tilt right or left)
Vector3 rollComponents = Vector3.UnitZ * VehicleOrientation;
// Figure out the yaw value for this much roll.
// Squared because that seems to give a good value
float yawAngle = (float)Math.Asin(rollComponents.Y * rollComponents.Y) * m_bankingEfficiency;
// Figure out the yaw value for this much roll.
float yawAngle = m_angularMotorDirection.X * m_bankingEfficiency;
// actual error = static turn error + dynamic turn error
float mixedYawAngle = yawAngle * (1f - m_bankingMix) + yawAngle * m_bankingMix * VehicleForwardSpeed;
float mixedYawAngle =(yawAngle * (1f - m_bankingMix)) + ((yawAngle * m_bankingMix) * VehicleForwardSpeed);
// TODO: the banking effect should not go to infinity but what to limit it to?
mixedYawAngle = ClampInRange(-20f, mixedYawAngle, 20f);
// And what should happen when this is being added to a user defined yaw that is already PI*4?
mixedYawAngle = ClampInRange(-12, mixedYawAngle, 12);
// Build the force vector to change rotation from what it is to what it should be
bankingContributionV.Z = -mixedYawAngle;
// Don't do it all at once.
bankingContributionV /= m_bankingTimescale;
// Don't do it all at once. Fudge because 1 second is too fast with most user defined roll as PI*4.
bankingContributionV /= m_bankingTimescale * BSParam.VehicleAngularBankingTimescaleFudge;
VehicleRotationalVelocity += bankingContributionV * VehicleOrientation;
//VehicleRotationalVelocity += bankingContributionV * VehicleOrientation;
VehicleRotationalVelocity += bankingContributionV;
VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}",
Prim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContributionV);

View File

@@ -123,6 +123,7 @@ public static class BSParam
public static Vector3 VehicleLinearFactor { get; private set; }
public static Vector3 VehicleAngularFactor { get; private set; }
public static float VehicleGroundGravityFudge { get; private set; }
public static float VehicleAngularBankingTimescaleFudge { get; private set; }
public static bool VehicleDebuggingEnabled { get; private set; }
// Linkset implementation parameters
@@ -543,10 +544,14 @@ public static class BSParam
0.0f,
(s) => { return VehicleRestitution; },
(s,v) => { VehicleRestitution = v; } ),
new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
0.2f,
(s) => { return VehicleGroundGravityFudge; },
(s,v) => { VehicleGroundGravityFudge = v; } ),
new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.",
60.0f,
(s) => { return VehicleAngularBankingTimescaleFudge; },
(s,v) => { VehicleAngularBankingTimescaleFudge = v; } ),
new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging",
false,
(s) => { return VehicleDebuggingEnabled; },