aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2012-07-12 15:34:25 -0700
committerRobert Adams2012-07-20 14:02:24 -0700
commitc400918c84fc89ff0209ee05def3bb46206ba5ee (patch)
treefc28a498207e20136a87528b937ec619ab3cbe3a /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: Add detailed and voluminous debug logging that is enabled (diff)
downloadopensim-SC-c400918c84fc89ff0209ee05def3bb46206ba5ee.zip
opensim-SC-c400918c84fc89ff0209ee05def3bb46206ba5ee.tar.gz
opensim-SC-c400918c84fc89ff0209ee05def3bb46206ba5ee.tar.bz2
opensim-SC-c400918c84fc89ff0209ee05def3bb46206ba5ee.tar.xz
BulletSim: Add PID variables to physical scene. Not PIDing yet, but soon.
Cleaned up code and got rid of compile warnings.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs116
1 files changed, 52 insertions, 64 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 9b28a06..23b276e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -148,7 +148,7 @@ public sealed class BSPrim : PhysicsActor
148 { 148 {
149 // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); 149 // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
150 // Undo any vehicle properties 150 // Undo any vehicle properties
151 _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE); 151 _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE, 1f);
152 _scene.RemoveVehiclePrim(this); // just to make sure 152 _scene.RemoveVehiclePrim(this); // just to make sure
153 153
154 // undo any dependance with/on other objects 154 // undo any dependance with/on other objects
@@ -353,7 +353,7 @@ public sealed class BSPrim : PhysicsActor
353 } 353 }
354 set { 354 set {
355 Vehicle type = (Vehicle)value; 355 Vehicle type = (Vehicle)value;
356 _vehicle.ProcessTypeChange(type); 356 _vehicle.ProcessTypeChange(type, _scene.LastSimulatedTimestep);
357 _scene.TaintedObject(delegate() 357 _scene.TaintedObject(delegate()
358 { 358 {
359 if (type == Vehicle.TYPE_NONE) 359 if (type == Vehicle.TYPE_NONE)
@@ -371,11 +371,11 @@ public sealed class BSPrim : PhysicsActor
371 } 371 }
372 public override void VehicleFloatParam(int param, float value) 372 public override void VehicleFloatParam(int param, float value)
373 { 373 {
374 _vehicle.ProcessFloatVehicleParam((Vehicle)param, value); 374 _vehicle.ProcessFloatVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep);
375 } 375 }
376 public override void VehicleVectorParam(int param, OMV.Vector3 value) 376 public override void VehicleVectorParam(int param, OMV.Vector3 value)
377 { 377 {
378 _vehicle.ProcessVectorVehicleParam((Vehicle)param, value); 378 _vehicle.ProcessVectorVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep);
379 } 379 }
380 public override void VehicleRotationParam(int param, OMV.Quaternion rotation) 380 public override void VehicleRotationParam(int param, OMV.Quaternion rotation)
381 { 381 {
@@ -1262,78 +1262,66 @@ public sealed class BSPrim : PhysicsActor
1262 const float POSITION_TOLERANCE = 0.05f; 1262 const float POSITION_TOLERANCE = 0.05f;
1263 const float ACCELERATION_TOLERANCE = 0.01f; 1263 const float ACCELERATION_TOLERANCE = 0.01f;
1264 const float ROTATIONAL_VELOCITY_TOLERANCE = 0.01f; 1264 const float ROTATIONAL_VELOCITY_TOLERANCE = 0.01f;
1265 const bool SHOULD_DAMP_UPDATES = false;
1266 1265
1267 public void UpdateProperties(EntityProperties entprop) 1266 public void UpdateProperties(EntityProperties entprop)
1268 { 1267 {
1268 /*
1269 UpdatedProperties changed = 0; 1269 UpdatedProperties changed = 0;
1270 if (SHOULD_DAMP_UPDATES) 1270 // assign to the local variables so the normal set action does not happen
1271 // if (_position != entprop.Position)
1272 if (!_position.ApproxEquals(entprop.Position, POSITION_TOLERANCE))
1271 { 1273 {
1272 // assign to the local variables so the normal set action does not happen 1274 _position = entprop.Position;
1273 // if (_position != entprop.Position) 1275 changed |= UpdatedProperties.Position;
1274 if (!_position.ApproxEquals(entprop.Position, POSITION_TOLERANCE))
1275 {
1276 _position = entprop.Position;
1277 // m_log.DebugFormat("{0}: UpdateProperties: id={1}, pos = {2}", LogHeader, LocalID, _position);
1278 changed |= UpdatedProperties.Position;
1279 }
1280 // if (_orientation != entprop.Rotation)
1281 if (!_orientation.ApproxEquals(entprop.Rotation, ROTATION_TOLERANCE))
1282 {
1283 _orientation = entprop.Rotation;
1284 // m_log.DebugFormat("{0}: UpdateProperties: id={1}, rot = {2}", LogHeader, LocalID, _orientation);
1285 changed |= UpdatedProperties.Rotation;
1286 }
1287 // if (_velocity != entprop.Velocity)
1288 if (!_velocity.ApproxEquals(entprop.Velocity, VELOCITY_TOLERANCE))
1289 {
1290 _velocity = entprop.Velocity;
1291 // m_log.DebugFormat("{0}: UpdateProperties: velocity = {1}", LogHeader, _velocity);
1292 changed |= UpdatedProperties.Velocity;
1293 }
1294 // if (_acceleration != entprop.Acceleration)
1295 if (!_acceleration.ApproxEquals(entprop.Acceleration, ACCELERATION_TOLERANCE))
1296 {
1297 _acceleration = entprop.Acceleration;
1298 // m_log.DebugFormat("{0}: UpdateProperties: acceleration = {1}", LogHeader, _acceleration);
1299 changed |= UpdatedProperties.Acceleration;
1300 }
1301 // if (_rotationalVelocity != entprop.RotationalVelocity)
1302 if (!_rotationalVelocity.ApproxEquals(entprop.RotationalVelocity, ROTATIONAL_VELOCITY_TOLERANCE))
1303 {
1304 _rotationalVelocity = entprop.RotationalVelocity;
1305 // m_log.DebugFormat("{0}: UpdateProperties: rotationalVelocity = {1}", LogHeader, _rotationalVelocity);
1306 changed |= UpdatedProperties.RotationalVel;
1307 }
1308 if (changed != 0)
1309 {
1310 // m_log.DebugFormat("{0}: UpdateProperties: id={1}, c={2}, pos={3}, rot={4}", LogHeader, LocalID, changed, _position, _orientation);
1311 // Only update the position of single objects and linkset roots
1312 if (this._parentPrim == null)
1313 {
1314 // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}", LogHeader, LocalID, changed, _position, _orientation);
1315 base.RequestPhysicsterseUpdate();
1316 }
1317 }
1318 } 1276 }
1319 else 1277 // if (_orientation != entprop.Rotation)
1278 if (!_orientation.ApproxEquals(entprop.Rotation, ROTATION_TOLERANCE))
1320 { 1279 {
1321 // Don't check for damping here -- it's done in BulletSim and SceneObjectPart. 1280 _orientation = entprop.Rotation;
1322 1281 changed |= UpdatedProperties.Rotation;
1323 // Only updates only for individual prims and for the root object of a linkset. 1282 }
1283 // if (_velocity != entprop.Velocity)
1284 if (!_velocity.ApproxEquals(entprop.Velocity, VELOCITY_TOLERANCE))
1285 {
1286 _velocity = entprop.Velocity;
1287 changed |= UpdatedProperties.Velocity;
1288 }
1289 // if (_acceleration != entprop.Acceleration)
1290 if (!_acceleration.ApproxEquals(entprop.Acceleration, ACCELERATION_TOLERANCE))
1291 {
1292 _acceleration = entprop.Acceleration;
1293 changed |= UpdatedProperties.Acceleration;
1294 }
1295 // if (_rotationalVelocity != entprop.RotationalVelocity)
1296 if (!_rotationalVelocity.ApproxEquals(entprop.RotationalVelocity, ROTATIONAL_VELOCITY_TOLERANCE))
1297 {
1298 _rotationalVelocity = entprop.RotationalVelocity;
1299 changed |= UpdatedProperties.RotationalVel;
1300 }
1301 if (changed != 0)
1302 {
1303 // Only update the position of single objects and linkset roots
1324 if (this._parentPrim == null) 1304 if (this._parentPrim == null)
1325 { 1305 {
1326 // Assign to the local variables so the normal set action does not happen
1327 _position = entprop.Position;
1328 _orientation = entprop.Rotation;
1329 _velocity = entprop.Velocity;
1330 _acceleration = entprop.Acceleration;
1331 _rotationalVelocity = entprop.RotationalVelocity;
1332 // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}",
1333 // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
1334 base.RequestPhysicsterseUpdate(); 1306 base.RequestPhysicsterseUpdate();
1335 } 1307 }
1336 } 1308 }
1309 */
1310
1311 // Don't check for damping here -- it's done in BulletSim and SceneObjectPart.
1312 // Updates only for individual prims and for the root object of a linkset.
1313 if (this._parentPrim == null)
1314 {
1315 // Assign to the local variables so the normal set action does not happen
1316 _position = entprop.Position;
1317 _orientation = entprop.Rotation;
1318 _velocity = entprop.Velocity;
1319 _acceleration = entprop.Acceleration;
1320 _rotationalVelocity = entprop.RotationalVelocity;
1321 // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}",
1322 // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
1323 base.RequestPhysicsterseUpdate();
1324 }
1337 } 1325 }
1338 1326
1339 // I've collided with something 1327 // I've collided with something