aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
authorRobert Adams2013-07-11 14:33:03 -0700
committerRobert Adams2013-07-22 10:27:15 -0700
commitb4c3a791aa55390bff071b3fe4bbe70c1d252703 (patch)
tree4823ba36ddaee6f13e7b11559d9701937ecf7cf1 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
parentAdd experimental stubs for an extension function interface on both (diff)
downloadopensim-SC_OLD-b4c3a791aa55390bff071b3fe4bbe70c1d252703.zip
opensim-SC_OLD-b4c3a791aa55390bff071b3fe4bbe70c1d252703.tar.gz
opensim-SC_OLD-b4c3a791aa55390bff071b3fe4bbe70c1d252703.tar.bz2
opensim-SC_OLD-b4c3a791aa55390bff071b3fe4bbe70c1d252703.tar.xz
BulletSim: move collision processing for linksets from BSPrimLinkable
into the linkset implementation classes. Add HasSomeCollision attribute that remembers of any component of a linkset has a collision. Update vehicle code (BSDynamic) to use the HasSomeCollision in place of IsColliding to make constraint based linksets properly notice the ground. Add linkset functions to change physical attributes of all the members of a linkset.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs16
1 files changed, 8 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 4c2c1c1..1540df1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1001 else if (newVelocityLengthSq < 0.001f) 1001 else if (newVelocityLengthSq < 0.001f)
1002 VehicleVelocity = Vector3.Zero; 1002 VehicleVelocity = Vector3.Zero;
1003 1003
1004 VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", ControllingPrim.LocalID, ControllingPrim.IsColliding, VehicleVelocity ); 1004 VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", ControllingPrim.LocalID, ControllingPrim.HasSomeCollision, VehicleVelocity );
1005 1005
1006 } // end MoveLinear() 1006 } // end MoveLinear()
1007 1007
@@ -1062,7 +1062,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1062 Vector3 linearDeflectionW = linearDeflectionV * VehicleOrientation; 1062 Vector3 linearDeflectionW = linearDeflectionV * VehicleOrientation;
1063 1063
1064 // Optionally, if not colliding, don't effect world downward velocity. Let falling things fall. 1064 // Optionally, if not colliding, don't effect world downward velocity. Let falling things fall.
1065 if (BSParam.VehicleLinearDeflectionNotCollidingNoZ && !m_controllingPrim.IsColliding) 1065 if (BSParam.VehicleLinearDeflectionNotCollidingNoZ && !m_controllingPrim.HasSomeCollision)
1066 { 1066 {
1067 linearDeflectionW.Z = 0f; 1067 linearDeflectionW.Z = 0f;
1068 } 1068 }
@@ -1222,7 +1222,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1222 float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition); 1222 float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition);
1223 distanceAboveGround = VehiclePosition.Z - targetHeight; 1223 distanceAboveGround = VehiclePosition.Z - targetHeight;
1224 // Not colliding if the vehicle is off the ground 1224 // Not colliding if the vehicle is off the ground
1225 if (!Prim.IsColliding) 1225 if (!Prim.HasSomeCollision)
1226 { 1226 {
1227 // downForce = new Vector3(0, 0, -distanceAboveGround / m_bankingTimescale); 1227 // downForce = new Vector3(0, 0, -distanceAboveGround / m_bankingTimescale);
1228 VehicleVelocity += new Vector3(0, 0, -distanceAboveGround); 1228 VehicleVelocity += new Vector3(0, 0, -distanceAboveGround);
@@ -1233,12 +1233,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1233 // be computed with a motor. 1233 // be computed with a motor.
1234 // TODO: add interaction with banking. 1234 // TODO: add interaction with banking.
1235 VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},colliding={2},ret={3}", 1235 VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},colliding={2},ret={3}",
1236 Prim.LocalID, distanceAboveGround, Prim.IsColliding, ret); 1236 Prim.LocalID, distanceAboveGround, Prim.HasSomeCollision, ret);
1237 */ 1237 */
1238 1238
1239 // Another approach is to measure if we're going up. If going up and not colliding, 1239 // Another approach is to measure if we're going up. If going up and not colliding,
1240 // the vehicle is in the air. Fix that by pushing down. 1240 // the vehicle is in the air. Fix that by pushing down.
1241 if (!ControllingPrim.IsColliding && VehicleVelocity.Z > 0.1) 1241 if (!ControllingPrim.HasSomeCollision && VehicleVelocity.Z > 0.1)
1242 { 1242 {
1243 // Get rid of any of the velocity vector that is pushing us up. 1243 // Get rid of any of the velocity vector that is pushing us up.
1244 float upVelocity = VehicleVelocity.Z; 1244 float upVelocity = VehicleVelocity.Z;
@@ -1260,7 +1260,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1260 } 1260 }
1261 */ 1261 */
1262 VDetailLog("{0}, MoveLinear,limitMotorUp,collide={1},upVel={2},newVel={3}", 1262 VDetailLog("{0}, MoveLinear,limitMotorUp,collide={1},upVel={2},newVel={3}",
1263 ControllingPrim.LocalID, ControllingPrim.IsColliding, upVelocity, VehicleVelocity); 1263 ControllingPrim.LocalID, ControllingPrim.HasSomeCollision, upVelocity, VehicleVelocity);
1264 } 1264 }
1265 } 1265 }
1266 } 1266 }
@@ -1270,14 +1270,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1270 Vector3 appliedGravity = m_VehicleGravity * m_vehicleMass; 1270 Vector3 appliedGravity = m_VehicleGravity * m_vehicleMass;
1271 1271
1272 // Hack to reduce downward force if the vehicle is probably sitting on the ground 1272 // Hack to reduce downward force if the vehicle is probably sitting on the ground
1273 if (ControllingPrim.IsColliding && IsGroundVehicle) 1273 if (ControllingPrim.HasSomeCollision && IsGroundVehicle)
1274 appliedGravity *= BSParam.VehicleGroundGravityFudge; 1274 appliedGravity *= BSParam.VehicleGroundGravityFudge;
1275 1275
1276 VehicleAddForce(appliedGravity); 1276 VehicleAddForce(appliedGravity);
1277 1277
1278 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={5}", 1278 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={5}",
1279 ControllingPrim.LocalID, m_VehicleGravity, 1279 ControllingPrim.LocalID, m_VehicleGravity,
1280 ControllingPrim.IsColliding, BSParam.VehicleGroundGravityFudge, m_vehicleMass, appliedGravity); 1280 ControllingPrim.HasSomeCollision, BSParam.VehicleGroundGravityFudge, m_vehicleMass, appliedGravity);
1281 } 1281 }
1282 1282
1283 // ======================================================================= 1283 // =======================================================================