aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs46
1 files changed, 24 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 48cd89b..a6bc8e2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -191,7 +191,7 @@ public sealed class BSPrim : PhysicsActor
191 { 191 {
192 _mass = CalculateMass(); // changing size changes the mass 192 _mass = CalculateMass(); // changing size changes the mass
193 BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); 193 BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical);
194 // DetailLog("{0}: BSPrim.setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); 194 DetailLog("{0}: BSPrim.setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical);
195 RecreateGeomAndObject(); 195 RecreateGeomAndObject();
196 }); 196 });
197 } 197 }
@@ -275,7 +275,7 @@ public sealed class BSPrim : PhysicsActor
275 275
276 public override void LockAngularMotion(OMV.Vector3 axis) 276 public override void LockAngularMotion(OMV.Vector3 axis)
277 { 277 {
278 // DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); 278 DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis);
279 return; 279 return;
280 } 280 }
281 281
@@ -294,7 +294,7 @@ public sealed class BSPrim : PhysicsActor
294 // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? 294 // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint?
295 _scene.TaintedObject("BSPrim.setPosition", delegate() 295 _scene.TaintedObject("BSPrim.setPosition", delegate()
296 { 296 {
297 // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 297 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
298 BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); 298 BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation);
299 }); 299 });
300 } 300 }
@@ -331,7 +331,7 @@ public sealed class BSPrim : PhysicsActor
331 _force = value; 331 _force = value;
332 _scene.TaintedObject("BSPrim.setForce", delegate() 332 _scene.TaintedObject("BSPrim.setForce", delegate()
333 { 333 {
334 // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); 334 DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
335 // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); 335 // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
336 BulletSimAPI.SetObjectForce2(Body.Ptr, _force); 336 BulletSimAPI.SetObjectForce2(Body.Ptr, _force);
337 }); 337 });
@@ -409,7 +409,7 @@ public sealed class BSPrim : PhysicsActor
409 _velocity = value; 409 _velocity = value;
410 _scene.TaintedObject("BSPrim.setVelocity", delegate() 410 _scene.TaintedObject("BSPrim.setVelocity", delegate()
411 { 411 {
412 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); 412 DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity);
413 BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); 413 BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity);
414 }); 414 });
415 } 415 }
@@ -417,7 +417,7 @@ public sealed class BSPrim : PhysicsActor
417 public override OMV.Vector3 Torque { 417 public override OMV.Vector3 Torque {
418 get { return _torque; } 418 get { return _torque; }
419 set { _torque = value; 419 set { _torque = value;
420 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); 420 DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque);
421 } 421 }
422 } 422 }
423 public override float CollisionScore { 423 public override float CollisionScore {
@@ -444,7 +444,7 @@ public sealed class BSPrim : PhysicsActor
444 _scene.TaintedObject("BSPrim.setOrientation", delegate() 444 _scene.TaintedObject("BSPrim.setOrientation", delegate()
445 { 445 {
446 // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); 446 // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID);
447 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); 447 DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
448 BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); 448 BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation);
449 }); 449 });
450 } 450 }
@@ -496,13 +496,15 @@ public sealed class BSPrim : PhysicsActor
496 _linkset.Refresh(this); 496 _linkset.Refresh(this);
497 497
498 CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr); 498 CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr);
499 // DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf); 499 DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf);
500 } 500 }
501 501
502 // prims don't fly 502 // prims don't fly
503 public override bool Flying { 503 public override bool Flying {
504 get { return _flying; } 504 get { return _flying; }
505 set { _flying = value; } 505 set {
506 _flying = value;
507 }
506 } 508 }
507 public override bool SetAlwaysRun { 509 public override bool SetAlwaysRun {
508 get { return _setAlwaysRun; } 510 get { return _setAlwaysRun; }
@@ -553,7 +555,7 @@ public sealed class BSPrim : PhysicsActor
553 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); 555 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
554 _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate() 556 _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
555 { 557 {
556 // DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); 558 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
557 BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); 559 BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity);
558 }); 560 });
559 } 561 }
@@ -570,7 +572,7 @@ public sealed class BSPrim : PhysicsActor
570 _buoyancy = value; 572 _buoyancy = value;
571 _scene.TaintedObject("BSPrim.setBuoyancy", delegate() 573 _scene.TaintedObject("BSPrim.setBuoyancy", delegate()
572 { 574 {
573 // DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 575 DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
574 BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); 576 BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy);
575 }); 577 });
576 } 578 }
@@ -633,17 +635,17 @@ public sealed class BSPrim : PhysicsActor
633 } 635 }
634 m_accumulatedForces.Clear(); 636 m_accumulatedForces.Clear();
635 } 637 }
636 // DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force); 638 DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force);
637 BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); 639 BulletSimAPI.AddObjectForce2(Body.Ptr, fSum);
638 }); 640 });
639 } 641 }
640 642
641 public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { 643 public override void AddAngularForce(OMV.Vector3 force, bool pushforce) {
642 // DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); 644 DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce);
643 // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); 645 // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce);
644 } 646 }
645 public override void SetMomentum(OMV.Vector3 momentum) { 647 public override void SetMomentum(OMV.Vector3 momentum) {
646 // DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); 648 DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum);
647 } 649 }
648 public override void SubscribeEvents(int ms) { 650 public override void SubscribeEvents(int ms) {
649 _subscribedEventsMs = ms; 651 _subscribedEventsMs = ms;
@@ -987,7 +989,7 @@ public sealed class BSPrim : PhysicsActor
987 // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); 989 // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size);
988 if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) 990 if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE))
989 { 991 {
990 // DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild); 992 DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild);
991 _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; 993 _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE;
992 // Bullet native objects are scaled by the Bullet engine so pass the size in 994 // Bullet native objects are scaled by the Bullet engine so pass the size in
993 _scale = _size; 995 _scale = _size;
@@ -1001,7 +1003,7 @@ public sealed class BSPrim : PhysicsActor
1001 // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); 1003 // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size);
1002 if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) 1004 if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX))
1003 { 1005 {
1004 // DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild); 1006 DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild);
1005 _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; 1007 _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX;
1006 _scale = _size; 1008 _scale = _size;
1007 // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? 1009 // TODO: do we need to check for and destroy a mesh or hull that might have been left from before?
@@ -1051,12 +1053,12 @@ public sealed class BSPrim : PhysicsActor
1051 // if this new shape is the same as last time, don't recreate the mesh 1053 // if this new shape is the same as last time, don't recreate the mesh
1052 if (_meshKey == newMeshKey) return; 1054 if (_meshKey == newMeshKey) return;
1053 1055
1054 // DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey); 1056 DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey);
1055 // Since we're recreating new, get rid of any previously generated shape 1057 // Since we're recreating new, get rid of any previously generated shape
1056 if (_meshKey != 0) 1058 if (_meshKey != 0)
1057 { 1059 {
1058 // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey); 1060 // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey);
1059 // DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey); 1061 DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey);
1060 BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); 1062 BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey);
1061 _mesh = null; 1063 _mesh = null;
1062 _meshKey = 0; 1064 _meshKey = 0;
@@ -1086,7 +1088,7 @@ public sealed class BSPrim : PhysicsActor
1086 _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH; 1088 _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH;
1087 // meshes are already scaled by the meshmerizer 1089 // meshes are already scaled by the meshmerizer
1088 _scale = new OMV.Vector3(1f, 1f, 1f); 1090 _scale = new OMV.Vector3(1f, 1f, 1f);
1089 // DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID); 1091 DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID);
1090 return; 1092 return;
1091 } 1093 }
1092 1094
@@ -1100,13 +1102,13 @@ public sealed class BSPrim : PhysicsActor
1100 // if the hull hasn't changed, don't rebuild it 1102 // if the hull hasn't changed, don't rebuild it
1101 if (newHullKey == _hullKey) return; 1103 if (newHullKey == _hullKey) return;
1102 1104
1103 // DetailLog("{0},BSPrim.CreateGeomHull,create,oldKey={1},newKey={2}", LocalID, _hullKey, newHullKey); 1105 DetailLog("{0},BSPrim.CreateGeomHull,create,oldKey={1},newKey={2}", LocalID, _hullKey, newHullKey);
1104 1106
1105 // Since we're recreating new, get rid of any previously generated shape 1107 // Since we're recreating new, get rid of any previously generated shape
1106 if (_hullKey != 0) 1108 if (_hullKey != 0)
1107 { 1109 {
1108 // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey); 1110 // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey);
1109 // DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _hullKey); 1111 DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _hullKey);
1110 BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey); 1112 BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey);
1111 _hullKey = 0; 1113 _hullKey = 0;
1112 } 1114 }
@@ -1200,7 +1202,7 @@ public sealed class BSPrim : PhysicsActor
1200 _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; 1202 _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL;
1201 // meshes are already scaled by the meshmerizer 1203 // meshes are already scaled by the meshmerizer
1202 _scale = new OMV.Vector3(1f, 1f, 1f); 1204 _scale = new OMV.Vector3(1f, 1f, 1f);
1203 // DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID); 1205 DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID);
1204 return; 1206 return;
1205 } 1207 }
1206 1208