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.cs91
1 files changed, 31 insertions, 60 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index d5b999d..15b7090 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
41 [Serializable] 41 [Serializable]
42public class BSPrim : BSPhysObject 42public class BSPrim : BSPhysObject
43{ 43{
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 private static readonly string LogHeader = "[BULLETS PRIM]"; 45 private static readonly string LogHeader = "[BULLETS PRIM]";
46 46
47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh. 47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh.
@@ -102,7 +102,7 @@ public class BSPrim : BSPhysObject
102 102
103 // DetailLog("{0},BSPrim.constructor,call", LocalID); 103 // DetailLog("{0},BSPrim.constructor,call", LocalID);
104 // do the actual object creation at taint time 104 // do the actual object creation at taint time
105 PhysScene.TaintedObject("BSPrim.create", delegate() 105 PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate()
106 { 106 {
107 // Make sure the object is being created with some sanity. 107 // Make sure the object is being created with some sanity.
108 ExtremeSanityCheck(true /* inTaintTime */); 108 ExtremeSanityCheck(true /* inTaintTime */);
@@ -126,7 +126,7 @@ public class BSPrim : BSPhysObject
126 // Undo any vehicle properties 126 // Undo any vehicle properties
127 this.VehicleType = (int)Vehicle.TYPE_NONE; 127 this.VehicleType = (int)Vehicle.TYPE_NONE;
128 128
129 PhysScene.TaintedObject("BSPrim.Destroy", delegate() 129 PhysScene.TaintedObject(LocalID, "BSPrim.Destroy", delegate()
130 { 130 {
131 DetailLog("{0},BSPrim.Destroy,taint,", LocalID); 131 DetailLog("{0},BSPrim.Destroy,taint,", LocalID);
132 // If there are physical body and shape, release my use of same. 132 // If there are physical body and shape, release my use of same.
@@ -161,7 +161,7 @@ public class BSPrim : BSPhysObject
161 } 161 }
162 public override bool ForceBodyShapeRebuild(bool inTaintTime) 162 public override bool ForceBodyShapeRebuild(bool inTaintTime)
163 { 163 {
164 PhysScene.TaintedObject(inTaintTime, "BSPrim.ForceBodyShapeRebuild", delegate() 164 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ForceBodyShapeRebuild", delegate()
165 { 165 {
166 _mass = CalculateMass(); // changing the shape changes the mass 166 _mass = CalculateMass(); // changing the shape changes the mass
167 CreateGeomAndObject(true); 167 CreateGeomAndObject(true);
@@ -178,7 +178,7 @@ public class BSPrim : BSPhysObject
178 if (value != _isSelected) 178 if (value != _isSelected)
179 { 179 {
180 _isSelected = value; 180 _isSelected = value;
181 PhysScene.TaintedObject("BSPrim.setSelected", delegate() 181 PhysScene.TaintedObject(LocalID, "BSPrim.setSelected", delegate()
182 { 182 {
183 DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected); 183 DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected);
184 SetObjectDynamic(false); 184 SetObjectDynamic(false);
@@ -224,7 +224,7 @@ public class BSPrim : BSPhysObject
224 _rotationalVelocity = OMV.Vector3.Zero; 224 _rotationalVelocity = OMV.Vector3.Zero;
225 225
226 // Zero some other properties in the physics engine 226 // Zero some other properties in the physics engine
227 PhysScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() 227 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate()
228 { 228 {
229 if (PhysBody.HasPhysicalBody) 229 if (PhysBody.HasPhysicalBody)
230 PhysScene.PE.ClearAllForces(PhysBody); 230 PhysScene.PE.ClearAllForces(PhysBody);
@@ -234,7 +234,7 @@ public class BSPrim : BSPhysObject
234 { 234 {
235 _rotationalVelocity = OMV.Vector3.Zero; 235 _rotationalVelocity = OMV.Vector3.Zero;
236 // Zero some other properties in the physics engine 236 // Zero some other properties in the physics engine
237 PhysScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() 237 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate()
238 { 238 {
239 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); 239 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
240 if (PhysBody.HasPhysicalBody) 240 if (PhysBody.HasPhysicalBody)
@@ -262,7 +262,7 @@ public class BSPrim : BSPhysObject
262 }); 262 });
263 263
264 // Update parameters so the new actor's Refresh() action is called at the right time. 264 // Update parameters so the new actor's Refresh() action is called at the right time.
265 PhysScene.TaintedObject("BSPrim.LockAngularMotion", delegate() 265 PhysScene.TaintedObject(LocalID, "BSPrim.LockAngularMotion", delegate()
266 { 266 {
267 UpdatePhysicalParameters(); 267 UpdatePhysicalParameters();
268 }); 268 });
@@ -287,7 +287,7 @@ public class BSPrim : BSPhysObject
287 RawPosition = value; 287 RawPosition = value;
288 PositionSanityCheck(false); 288 PositionSanityCheck(false);
289 289
290 PhysScene.TaintedObject("BSPrim.setPosition", delegate() 290 PhysScene.TaintedObject(LocalID, "BSPrim.setPosition", delegate()
291 { 291 {
292 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, RawPosition, RawOrientation); 292 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, RawPosition, RawOrientation);
293 ForcePosition = RawPosition; 293 ForcePosition = RawPosition;
@@ -531,7 +531,7 @@ public class BSPrim : BSPhysObject
531 set { 531 set {
532 Vehicle type = (Vehicle)value; 532 Vehicle type = (Vehicle)value;
533 533
534 PhysScene.TaintedObject("setVehicleType", delegate() 534 PhysScene.TaintedObject(LocalID, "setVehicleType", delegate()
535 { 535 {
536 // Some vehicle scripts change vehicle type on the fly as an easy way to 536 // Some vehicle scripts change vehicle type on the fly as an easy way to
537 // change all the parameters. Like a plane changing to CAR when on the 537 // change all the parameters. Like a plane changing to CAR when on the
@@ -561,7 +561,7 @@ public class BSPrim : BSPhysObject
561 } 561 }
562 public override void VehicleFloatParam(int param, float value) 562 public override void VehicleFloatParam(int param, float value)
563 { 563 {
564 PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() 564 PhysScene.TaintedObject(LocalID, "BSPrim.VehicleFloatParam", delegate()
565 { 565 {
566 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 566 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
567 if (vehicleActor != null) 567 if (vehicleActor != null)
@@ -573,7 +573,7 @@ public class BSPrim : BSPhysObject
573 } 573 }
574 public override void VehicleVectorParam(int param, OMV.Vector3 value) 574 public override void VehicleVectorParam(int param, OMV.Vector3 value)
575 { 575 {
576 PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() 576 PhysScene.TaintedObject(LocalID, "BSPrim.VehicleVectorParam", delegate()
577 { 577 {
578 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 578 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
579 if (vehicleActor != null) 579 if (vehicleActor != null)
@@ -585,7 +585,7 @@ public class BSPrim : BSPhysObject
585 } 585 }
586 public override void VehicleRotationParam(int param, OMV.Quaternion rotation) 586 public override void VehicleRotationParam(int param, OMV.Quaternion rotation)
587 { 587 {
588 PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() 588 PhysScene.TaintedObject(LocalID, "BSPrim.VehicleRotationParam", delegate()
589 { 589 {
590 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 590 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
591 if (vehicleActor != null) 591 if (vehicleActor != null)
@@ -597,7 +597,7 @@ public class BSPrim : BSPhysObject
597 } 597 }
598 public override void VehicleFlags(int param, bool remove) 598 public override void VehicleFlags(int param, bool remove)
599 { 599 {
600 PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate() 600 PhysScene.TaintedObject(LocalID, "BSPrim.VehicleFlags", delegate()
601 { 601 {
602 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 602 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
603 if (vehicleActor != null) 603 if (vehicleActor != null)
@@ -613,7 +613,7 @@ public class BSPrim : BSPhysObject
613 if (_isVolumeDetect != newValue) 613 if (_isVolumeDetect != newValue)
614 { 614 {
615 _isVolumeDetect = newValue; 615 _isVolumeDetect = newValue;
616 PhysScene.TaintedObject("BSPrim.SetVolumeDetect", delegate() 616 PhysScene.TaintedObject(LocalID, "BSPrim.SetVolumeDetect", delegate()
617 { 617 {
618 // DetailLog("{0},setVolumeDetect,taint,volDetect={1}", LocalID, _isVolumeDetect); 618 // DetailLog("{0},setVolumeDetect,taint,volDetect={1}", LocalID, _isVolumeDetect);
619 SetObjectDynamic(true); 619 SetObjectDynamic(true);
@@ -628,7 +628,7 @@ public class BSPrim : BSPhysObject
628 public override void SetMaterial(int material) 628 public override void SetMaterial(int material)
629 { 629 {
630 base.SetMaterial(material); 630 base.SetMaterial(material);
631 PhysScene.TaintedObject("BSPrim.SetMaterial", delegate() 631 PhysScene.TaintedObject(LocalID, "BSPrim.SetMaterial", delegate()
632 { 632 {
633 UpdatePhysicalParameters(); 633 UpdatePhysicalParameters();
634 }); 634 });
@@ -641,7 +641,7 @@ public class BSPrim : BSPhysObject
641 if (base.Friction != value) 641 if (base.Friction != value)
642 { 642 {
643 base.Friction = value; 643 base.Friction = value;
644 PhysScene.TaintedObject("BSPrim.setFriction", delegate() 644 PhysScene.TaintedObject(LocalID, "BSPrim.setFriction", delegate()
645 { 645 {
646 UpdatePhysicalParameters(); 646 UpdatePhysicalParameters();
647 }); 647 });
@@ -656,7 +656,7 @@ public class BSPrim : BSPhysObject
656 if (base.Restitution != value) 656 if (base.Restitution != value)
657 { 657 {
658 base.Restitution = value; 658 base.Restitution = value;
659 PhysScene.TaintedObject("BSPrim.setRestitution", delegate() 659 PhysScene.TaintedObject(LocalID, "BSPrim.setRestitution", delegate()
660 { 660 {
661 UpdatePhysicalParameters(); 661 UpdatePhysicalParameters();
662 }); 662 });
@@ -673,7 +673,7 @@ public class BSPrim : BSPhysObject
673 if (base.Density != value) 673 if (base.Density != value)
674 { 674 {
675 base.Density = value; 675 base.Density = value;
676 PhysScene.TaintedObject("BSPrim.setDensity", delegate() 676 PhysScene.TaintedObject(LocalID, "BSPrim.setDensity", delegate()
677 { 677 {
678 UpdatePhysicalParameters(); 678 UpdatePhysicalParameters();
679 }); 679 });
@@ -688,7 +688,7 @@ public class BSPrim : BSPhysObject
688 if (base.GravModifier != value) 688 if (base.GravModifier != value)
689 { 689 {
690 base.GravModifier = value; 690 base.GravModifier = value;
691 PhysScene.TaintedObject("BSPrim.setGravityModifier", delegate() 691 PhysScene.TaintedObject(LocalID, "BSPrim.setGravityModifier", delegate()
692 { 692 {
693 UpdatePhysicalParameters(); 693 UpdatePhysicalParameters();
694 }); 694 });
@@ -699,7 +699,7 @@ public class BSPrim : BSPhysObject
699 get { return RawVelocity; } 699 get { return RawVelocity; }
700 set { 700 set {
701 RawVelocity = value; 701 RawVelocity = value;
702 PhysScene.TaintedObject("BSPrim.setVelocity", delegate() 702 PhysScene.TaintedObject(LocalID, "BSPrim.setVelocity", delegate()
703 { 703 {
704 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, RawVelocity); 704 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, RawVelocity);
705 ForceVelocity = RawVelocity; 705 ForceVelocity = RawVelocity;
@@ -745,7 +745,7 @@ public class BSPrim : BSPhysObject
745 return; 745 return;
746 RawOrientation = value; 746 RawOrientation = value;
747 747
748 PhysScene.TaintedObject("BSPrim.setOrientation", delegate() 748 PhysScene.TaintedObject(LocalID, "BSPrim.setOrientation", delegate()
749 { 749 {
750 ForceOrientation = RawOrientation; 750 ForceOrientation = RawOrientation;
751 }); 751 });
@@ -776,7 +776,7 @@ public class BSPrim : BSPhysObject
776 if (_isPhysical != value) 776 if (_isPhysical != value)
777 { 777 {
778 _isPhysical = value; 778 _isPhysical = value;
779 PhysScene.TaintedObject("BSPrim.setIsPhysical", delegate() 779 PhysScene.TaintedObject(LocalID, "BSPrim.setIsPhysical", delegate()
780 { 780 {
781 DetailLog("{0},setIsPhysical,taint,isPhys={1}", LocalID, _isPhysical); 781 DetailLog("{0},setIsPhysical,taint,isPhys={1}", LocalID, _isPhysical);
782 SetObjectDynamic(true); 782 SetObjectDynamic(true);
@@ -1020,7 +1020,7 @@ public class BSPrim : BSPhysObject
1020 public override bool FloatOnWater { 1020 public override bool FloatOnWater {
1021 set { 1021 set {
1022 _floatOnWater = value; 1022 _floatOnWater = value;
1023 PhysScene.TaintedObject("BSPrim.setFloatOnWater", delegate() 1023 PhysScene.TaintedObject(LocalID, "BSPrim.setFloatOnWater", delegate()
1024 { 1024 {
1025 if (_floatOnWater) 1025 if (_floatOnWater)
1026 CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); 1026 CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
@@ -1037,7 +1037,7 @@ public class BSPrim : BSPhysObject
1037 _rotationalVelocity = value; 1037 _rotationalVelocity = value;
1038 Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); 1038 Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity);
1039 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); 1039 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
1040 PhysScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() 1040 PhysScene.TaintedObject(LocalID, "BSPrim.setRotationalVelocity", delegate()
1041 { 1041 {
1042 ForceRotationalVelocity = _rotationalVelocity; 1042 ForceRotationalVelocity = _rotationalVelocity;
1043 }); 1043 });
@@ -1068,7 +1068,7 @@ public class BSPrim : BSPhysObject
1068 get { return _buoyancy; } 1068 get { return _buoyancy; }
1069 set { 1069 set {
1070 _buoyancy = value; 1070 _buoyancy = value;
1071 PhysScene.TaintedObject("BSPrim.setBuoyancy", delegate() 1071 PhysScene.TaintedObject(LocalID, "BSPrim.setBuoyancy", delegate()
1072 { 1072 {
1073 ForceBuoyancy = _buoyancy; 1073 ForceBuoyancy = _buoyancy;
1074 }); 1074 });
@@ -1142,7 +1142,7 @@ public class BSPrim : BSPhysObject
1142 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); 1142 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
1143 1143
1144 OMV.Vector3 addForce = force; 1144 OMV.Vector3 addForce = force;
1145 PhysScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1145 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.AddForce", delegate()
1146 { 1146 {
1147 // Bullet adds this central force to the total force for this tick. 1147 // Bullet adds this central force to the total force for this tick.
1148 // Deep down in Bullet: 1148 // Deep down in Bullet:
@@ -1172,7 +1172,7 @@ public class BSPrim : BSPhysObject
1172 OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude); 1172 OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude);
1173 // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse); 1173 // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse);
1174 1174
1175 PhysScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate() 1175 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.AddImpulse", delegate()
1176 { 1176 {
1177 // Bullet adds this impulse immediately to the velocity 1177 // Bullet adds this impulse immediately to the velocity
1178 DetailLog("{0},BSPrim.addForceImpulse,taint,impulseforce={1}", LocalID, addImpulse); 1178 DetailLog("{0},BSPrim.addForceImpulse,taint,impulseforce={1}", LocalID, addImpulse);
@@ -1197,7 +1197,7 @@ public class BSPrim : BSPhysObject
1197 if (force.IsFinite()) 1197 if (force.IsFinite())
1198 { 1198 {
1199 OMV.Vector3 angForce = force; 1199 OMV.Vector3 angForce = force;
1200 PhysScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate() 1200 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.AddAngularForce", delegate()
1201 { 1201 {
1202 if (PhysBody.HasPhysicalBody) 1202 if (PhysBody.HasPhysicalBody)
1203 { 1203 {
@@ -1221,7 +1221,7 @@ public class BSPrim : BSPhysObject
1221 public void ApplyTorqueImpulse(OMV.Vector3 impulse, bool inTaintTime) 1221 public void ApplyTorqueImpulse(OMV.Vector3 impulse, bool inTaintTime)
1222 { 1222 {
1223 OMV.Vector3 applyImpulse = impulse; 1223 OMV.Vector3 applyImpulse = impulse;
1224 PhysScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate() 1224 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ApplyTorqueImpulse", delegate()
1225 { 1225 {
1226 if (PhysBody.HasPhysicalBody) 1226 if (PhysBody.HasPhysicalBody)
1227 { 1227 {
@@ -1552,39 +1552,10 @@ public class BSPrim : BSPhysObject
1552 #region Extension 1552 #region Extension
1553 public override object Extension(string pFunct, params object[] pParams) 1553 public override object Extension(string pFunct, params object[] pParams)
1554 { 1554 {
1555 DetailLog("{0} BSPrim.Extension,op={1}", LocalID, pFunct);
1555 object ret = null; 1556 object ret = null;
1556 switch (pFunct) 1557 switch (pFunct)
1557 { 1558 {
1558 case BSScene.PhysFunctGetLinksetType:
1559 {
1560 BSPrimLinkable myHandle = this as BSPrimLinkable;
1561 if (myHandle != null)
1562 {
1563 ret = (object)myHandle.LinksetType;
1564 }
1565 m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret);
1566 break;
1567 }
1568 case BSScene.PhysFunctSetLinksetType:
1569 {
1570 if (pParams.Length > 0)
1571 {
1572 BSLinkset.LinksetImplementation linksetType = (BSLinkset.LinksetImplementation)pParams[0];
1573 BSPrimLinkable myHandle = this as BSPrimLinkable;
1574 if (myHandle != null && myHandle.Linkset.IsRoot(myHandle))
1575 {
1576 PhysScene.TaintedObject("BSPrim.PhysFunctSetLinksetType", delegate()
1577 {
1578 // Cause the linkset type to change
1579 m_log.DebugFormat("{0} Extension.physSetLinksetType, oldType={1}, newType={2}",
1580 LogHeader, myHandle.Linkset.LinksetImpl, linksetType);
1581 myHandle.ConvertLinkset(linksetType);
1582 });
1583 }
1584 ret = (object)(int)linksetType;
1585 }
1586 break;
1587 }
1588 default: 1559 default:
1589 ret = base.Extension(pFunct, pParams); 1560 ret = base.Extension(pFunct, pParams);
1590 break; 1561 break;