aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2013-04-07 14:05:35 -0700
committerRobert Adams2013-04-08 06:27:44 -0700
commita7a1b8b7e9269b446e3396a35153b00942c1e35b (patch)
treedf4c7041eb9a2819dd6e17aa2f95768a552f31e3 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: complete movement of physical object action code out of the (diff)
downloadopensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.zip
opensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.tar.gz
opensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.tar.bz2
opensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.tar.xz
BulletSim: clean up actor code so routines use the same coding pattern.
Fix a few enabling problems.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs22
1 files changed, 11 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 71fea59..16c7a90 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -95,6 +95,7 @@ public class BSPrim : BSPhysObject
95 _isPhysical = pisPhysical; 95 _isPhysical = pisPhysical;
96 _isVolumeDetect = false; 96 _isVolumeDetect = false;
97 97
98 // We keep a handle to the vehicle actor so we can set vehicle parameters later.
98 VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName); 99 VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName);
99 PhysicalActors.Add(VehicleActorName, VehicleActor); 100 PhysicalActors.Add(VehicleActorName, VehicleActor);
100 101
@@ -264,7 +265,7 @@ public class BSPrim : BSPhysObject
264 if (axis.Z != 1) locking.Z = 0f; 265 if (axis.Z != 1) locking.Z = 0f;
265 LockedAxis = locking; 266 LockedAxis = locking;
266 267
267 CreateRemoveActor(LockedAxis != LockedAxisFree /* creatActor */, LockedAxisActorName, false /* inTaintTime */, delegate() 268 EnableActor(LockedAxis != LockedAxisFree, LockedAxisActorName, delegate()
268 { 269 {
269 return new BSActorLockAxis(PhysicsScene, this, LockedAxisActorName); 270 return new BSActorLockAxis(PhysicsScene, this, LockedAxisActorName);
270 }); 271 });
@@ -501,7 +502,7 @@ public class BSPrim : BSPhysObject
501 get { return RawForce; } 502 get { return RawForce; }
502 set { 503 set {
503 RawForce = value; 504 RawForce = value;
504 CreateRemoveActor(RawForce == OMV.Vector3.Zero, SetForceActorName, false /* inTaintTime */, delegate() 505 EnableActor(RawForce != OMV.Vector3.Zero, SetForceActorName, delegate()
505 { 506 {
506 return new BSActorSetForce(PhysicsScene, this, SetForceActorName); 507 return new BSActorSetForce(PhysicsScene, this, SetForceActorName);
507 }); 508 });
@@ -510,14 +511,13 @@ public class BSPrim : BSPhysObject
510 511
511 public override int VehicleType { 512 public override int VehicleType {
512 get { 513 get {
513 return (int)VehicleActor.Type; // if we are a vehicle, return that type 514 return (int)VehicleActor.Type;
514 } 515 }
515 set { 516 set {
516 Vehicle type = (Vehicle)value; 517 Vehicle type = (Vehicle)value;
517 518
518 PhysicsScene.TaintedObject("setVehicleType", delegate() 519 PhysicsScene.TaintedObject("setVehicleType", delegate()
519 { 520 {
520 // Done at taint time so we're sure the physics engine is not using the variables
521 // Vehicle code changes the parameters for this vehicle type. 521 // Vehicle code changes the parameters for this vehicle type.
522 VehicleActor.ProcessTypeChange(type); 522 VehicleActor.ProcessTypeChange(type);
523 ActivateIfPhysical(false); 523 ActivateIfPhysical(false);
@@ -669,11 +669,11 @@ public class BSPrim : BSPhysObject
669 get { return RawTorque; } 669 get { return RawTorque; }
670 set { 670 set {
671 RawTorque = value; 671 RawTorque = value;
672 CreateRemoveActor(RawTorque == OMV.Vector3.Zero, SetTorqueActorName, false /* inTaintTime */, delegate() 672 EnableActor(RawTorque != OMV.Vector3.Zero, SetTorqueActorName, delegate()
673 { 673 {
674 return new BSActorSetTorque(PhysicsScene, this, SetTorqueActorName); 674 return new BSActorSetTorque(PhysicsScene, this, SetTorqueActorName);
675 }); 675 });
676 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); 676 DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque);
677 } 677 }
678 } 678 }
679 public override OMV.Vector3 Acceleration { 679 public override OMV.Vector3 Acceleration {
@@ -786,7 +786,6 @@ public class BSPrim : BSPhysObject
786 MakeDynamic(IsStatic); 786 MakeDynamic(IsStatic);
787 787
788 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters) 788 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters)
789 VehicleActor.Refresh();
790 PhysicalActors.Refresh(); 789 PhysicalActors.Refresh();
791 790
792 // Arrange for collision events if the simulator wants them 791 // Arrange for collision events if the simulator wants them
@@ -1037,7 +1036,7 @@ public class BSPrim : BSPhysObject
1037 public override bool PIDActive { 1036 public override bool PIDActive {
1038 set { 1037 set {
1039 base.MoveToTargetActive = value; 1038 base.MoveToTargetActive = value;
1040 CreateRemoveActor(MoveToTargetActive, MoveToTargetActorName, false /* inTaintTime */, delegate() 1039 EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate()
1041 { 1040 {
1042 return new BSActorMoveToTarget(PhysicsScene, this, MoveToTargetActorName); 1041 return new BSActorMoveToTarget(PhysicsScene, this, MoveToTargetActorName);
1043 }); 1042 });
@@ -1049,7 +1048,7 @@ public class BSPrim : BSPhysObject
1049 public override bool PIDHoverActive { 1048 public override bool PIDHoverActive {
1050 set { 1049 set {
1051 base.HoverActive = value; 1050 base.HoverActive = value;
1052 CreateRemoveActor(HoverActive /* creatActor */, HoverActorName, false /* inTaintTime */, delegate() 1051 EnableActor(HoverActive, HoverActorName, delegate()
1053 { 1052 {
1054 return new BSActorHover(PhysicsScene, this, HoverActorName); 1053 return new BSActorHover(PhysicsScene, this, HoverActorName);
1055 }); 1054 });
@@ -1458,7 +1457,7 @@ public class BSPrim : BSPhysObject
1458 { 1457 {
1459 // Create the correct physical representation for this type of object. 1458 // Create the correct physical representation for this type of object.
1460 // Updates base.PhysBody and base.PhysShape with the new information. 1459 // Updates base.PhysBody and base.PhysShape with the new information.
1461 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. 1460 // Ignore 'forceRebuild'. 'GetBodyAndShape' makes the right choices and changes of necessary.
1462 PhysicsScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysicsScene.World, this, null, delegate(BulletBody dBody) 1461 PhysicsScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysicsScene.World, this, null, delegate(BulletBody dBody)
1463 { 1462 {
1464 // Called if the current prim body is about to be destroyed. 1463 // Called if the current prim body is about to be destroyed.
@@ -1472,9 +1471,9 @@ public class BSPrim : BSPhysObject
1472 return; 1471 return;
1473 } 1472 }
1474 1473
1474 // Called at taint-time
1475 protected virtual void RemoveBodyDependencies() 1475 protected virtual void RemoveBodyDependencies()
1476 { 1476 {
1477 VehicleActor.RemoveBodyDependencies();
1478 PhysicalActors.RemoveBodyDependencies(); 1477 PhysicalActors.RemoveBodyDependencies();
1479 } 1478 }
1480 1479
@@ -1482,6 +1481,7 @@ public class BSPrim : BSPhysObject
1482 // the world that things have changed. 1481 // the world that things have changed.
1483 public override void UpdateProperties(EntityProperties entprop) 1482 public override void UpdateProperties(EntityProperties entprop)
1484 { 1483 {
1484 // Let anyone (like the actors) modify the updated properties before they are pushed into the object and the simulator.
1485 TriggerPreUpdatePropertyAction(ref entprop); 1485 TriggerPreUpdatePropertyAction(ref entprop);
1486 1486
1487 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1487 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG