From 93393fb975f3886c448b6f945705304552fe8875 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 10 Dec 2012 16:46:12 -0800 Subject: BulletSim: comment out some chatty debug logging. Rearrange some code in BSDynamics to make velocity vs force calculation clearer. --- OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index fa3110c..cb84456 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs @@ -818,6 +818,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin + hoverContribution + limitMotorUpContribution; + Vector3 newForce = buoyancyContribution; + // If not changing some axis, reduce out velocity if ((m_flags & (VehicleFlag.NO_X)) != 0) newVelocity.X = 0; @@ -845,7 +847,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin VehicleVelocity = newVelocity; // Other linear forces are applied as forces. - Vector3 totalDownForce = buoyancyContribution * m_vehicleMass; + Vector3 totalDownForce = newForce * m_vehicleMass; if (!totalDownForce.ApproxEquals(Vector3.Zero, 0.01f)) { VehicleAddForce(totalDownForce); @@ -1005,8 +1007,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin // has a decay factor. This says this force should // be computed with a motor. // TODO: add interaction with banking. - VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},downForce={2}", - Prim.LocalID, distanceAboveGround, ret); + VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},colliding={2},ret={3}", + Prim.LocalID, distanceAboveGround, Prim.IsColliding, ret); } return ret; } -- cgit v1.1 From 8b861e880ad128edc0267b8e2d5931cfc8a142bc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Dec 2012 00:13:13 -0800 Subject: BulletSim: add ini file and command line parameters to control dumping of physical vehicle parameters (out of Bullet) on each simulation step and to optionally scale vehicle angular velocity by the time step. The latter looks to be part of a difference between angular parameters for ODE and BulletSim. SL docs say angular velocity is measured in radians/timeScale. Not sure if this is different than what ODE does. --- OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index cb84456..acddc09 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs @@ -570,8 +570,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr); - VDetailLog("{0},BSDynamics.Refresh,frict={1},inert={2},aDamp={3}", - Prim.LocalID, friction, localInertia, angularDamping); + VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}", + Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping); } else { @@ -1057,7 +1057,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin // TODO: Should this be applied as an angular force (torque)? if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f)) { - Vector3 scaledCorrection = m_lastAngularCorrection * pTimestep; + // DEBUG DEBUG DEBUG: optionally scale the angular velocity. Debugging SL vs ODE turning functions. + Vector3 scaledCorrection = m_lastAngularCorrection; + if (PhysicsScene.VehicleScaleAngularVelocityByTimestep) + scaledCorrection *= pTimestep; VehicleRotationalVelocity = scaledCorrection; VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}", -- cgit v1.1 From 905d7c43ad34869df03b21fcd24eb8ea8c6beeae Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Dec 2012 00:35:16 -0800 Subject: BulletSim: modify LIMIT_MOTOR_UP to limit BOAT types to be at water rather than ground level. This makes boats float at water level better but not perfectly. There probably needs to be some interaction between HOVER and LIMIT_MOTOR_UP. --- OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index acddc09..82e829e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs @@ -993,8 +993,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0) { - // If the vehicle is motoring into the sky, get it going back down. - float distanceAboveGround = VehiclePosition.Z - GetTerrainHeight(VehiclePosition); + float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition); + float distanceAboveGround = VehiclePosition.Z - targetHeight; // Not colliding if the vehicle is off the ground if (!Prim.IsColliding) { -- cgit v1.1