aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorRobert Adams2013-07-22 12:08:49 -0700
committerRobert Adams2013-07-22 12:08:49 -0700
commit5f7b2ea81b95a60e882bc65b663a2c9fe134f92a (patch)
tree4823ba36ddaee6f13e7b11559d9701937ecf7cf1 /OpenSim/Region/Physics/BulletSPlugin
parentRevert "BulletSim: change BSDynamics to expect to be passed a BSPrimLinkable" (diff)
downloadopensim-SC_OLD-5f7b2ea81b95a60e882bc65b663a2c9fe134f92a.zip
opensim-SC_OLD-5f7b2ea81b95a60e882bc65b663a2c9fe134f92a.tar.gz
opensim-SC_OLD-5f7b2ea81b95a60e882bc65b663a2c9fe134f92a.tar.bz2
opensim-SC_OLD-5f7b2ea81b95a60e882bc65b663a2c9fe134f92a.tar.xz
Revert "BulletSim: only create vehicle prim actor when vehicles are enabled."
The changes don't seem to be ready for prime time. This reverts commit acb7b4a09ad564d1dfae3ad12adbb593ca3942c9.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs43
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs2
2 files changed, 12 insertions, 33 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index fdb2925..4771934 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -96,7 +96,7 @@ public class BSPrim : BSPhysObject
96 _isVolumeDetect = false; 96 _isVolumeDetect = false;
97 97
98 // Add a dynamic vehicle to our set of actors that can move this prim. 98 // Add a dynamic vehicle to our set of actors that can move this prim.
99 // PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysScene, this, VehicleActorName)); 99 PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysScene, this, VehicleActorName));
100 100
101 _mass = CalculateMass(); 101 _mass = CalculateMass();
102 102
@@ -497,7 +497,7 @@ public class BSPrim : BSPhysObject
497 497
498 // Find and return a handle to the current vehicle actor. 498 // Find and return a handle to the current vehicle actor.
499 // Return 'null' if there is no vehicle actor. 499 // Return 'null' if there is no vehicle actor.
500 public BSDynamics GetVehicleActor(bool createIfNone) 500 public BSDynamics GetVehicleActor()
501 { 501 {
502 BSDynamics ret = null; 502 BSDynamics ret = null;
503 BSActor actor; 503 BSActor actor;
@@ -505,21 +505,13 @@ public class BSPrim : BSPhysObject
505 { 505 {
506 ret = actor as BSDynamics; 506 ret = actor as BSDynamics;
507 } 507 }
508 else
509 {
510 if (createIfNone)
511 {
512 ret = new BSDynamics(PhysScene, this, VehicleActorName);
513 PhysicalActors.Add(ret.ActorName, ret);
514 }
515 }
516 return ret; 508 return ret;
517 } 509 }
518 510
519 public override int VehicleType { 511 public override int VehicleType {
520 get { 512 get {
521 int ret = (int)Vehicle.TYPE_NONE; 513 int ret = (int)Vehicle.TYPE_NONE;
522 BSDynamics vehicleActor = GetVehicleActor(false /* createIfNone */); 514 BSDynamics vehicleActor = GetVehicleActor();
523 if (vehicleActor != null) 515 if (vehicleActor != null)
524 ret = (int)vehicleActor.Type; 516 ret = (int)vehicleActor.Type;
525 return ret; 517 return ret;
@@ -533,24 +525,11 @@ public class BSPrim : BSPhysObject
533 // change all the parameters. Like a plane changing to CAR when on the 525 // change all the parameters. Like a plane changing to CAR when on the
534 // ground. In this case, don't want to zero motion. 526 // ground. In this case, don't want to zero motion.
535 // ZeroMotion(true /* inTaintTime */); 527 // ZeroMotion(true /* inTaintTime */);
536 if (type == Vehicle.TYPE_NONE) 528 BSDynamics vehicleActor = GetVehicleActor();
537 { 529 if (vehicleActor != null)
538 // Vehicle type is 'none' so get rid of any actor that may have been allocated.
539 BSDynamics vehicleActor = GetVehicleActor(false /* createIfNone */);
540 if (vehicleActor != null)
541 {
542 PhysicalActors.RemoveAndRelease(vehicleActor.ActorName);
543 }
544 }
545 else
546 { 530 {
547 // Vehicle type is not 'none' so create an actor and set it running. 531 vehicleActor.ProcessTypeChange(type);
548 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 532 ActivateIfPhysical(false);
549 if (vehicleActor != null)
550 {
551 vehicleActor.ProcessTypeChange(type);
552 ActivateIfPhysical(false);
553 }
554 } 533 }
555 }); 534 });
556 } 535 }
@@ -559,7 +538,7 @@ public class BSPrim : BSPhysObject
559 { 538 {
560 PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() 539 PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
561 { 540 {
562 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 541 BSDynamics vehicleActor = GetVehicleActor();
563 if (vehicleActor != null) 542 if (vehicleActor != null)
564 { 543 {
565 vehicleActor.ProcessFloatVehicleParam((Vehicle)param, value); 544 vehicleActor.ProcessFloatVehicleParam((Vehicle)param, value);
@@ -571,7 +550,7 @@ public class BSPrim : BSPhysObject
571 { 550 {
572 PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() 551 PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
573 { 552 {
574 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 553 BSDynamics vehicleActor = GetVehicleActor();
575 if (vehicleActor != null) 554 if (vehicleActor != null)
576 { 555 {
577 vehicleActor.ProcessVectorVehicleParam((Vehicle)param, value); 556 vehicleActor.ProcessVectorVehicleParam((Vehicle)param, value);
@@ -583,7 +562,7 @@ public class BSPrim : BSPhysObject
583 { 562 {
584 PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() 563 PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
585 { 564 {
586 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 565 BSDynamics vehicleActor = GetVehicleActor();
587 if (vehicleActor != null) 566 if (vehicleActor != null)
588 { 567 {
589 vehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation); 568 vehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation);
@@ -595,7 +574,7 @@ public class BSPrim : BSPhysObject
595 { 574 {
596 PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate() 575 PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate()
597 { 576 {
598 BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); 577 BSDynamics vehicleActor = GetVehicleActor();
599 if (vehicleActor != null) 578 if (vehicleActor != null)
600 { 579 {
601 vehicleActor.ProcessVehicleFlags(param, remove); 580 vehicleActor.ProcessVehicleFlags(param, remove);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
index 48e74eb..48d3742 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
@@ -116,7 +116,7 @@ public class BasicVehicles : OpenSimTestCase
116 // Instead the appropriate values are set and calls are made just the parts of the 116 // Instead the appropriate values are set and calls are made just the parts of the
117 // controller we want to exercise. Stepping the physics engine then applies 117 // controller we want to exercise. Stepping the physics engine then applies
118 // the actions of that one feature. 118 // the actions of that one feature.
119 BSDynamics vehicleActor = TestVehicle.GetVehicleActor(true /* createIfNone */); 119 BSDynamics vehicleActor = TestVehicle.GetVehicleActor();
120 if (vehicleActor != null) 120 if (vehicleActor != null)
121 { 121 {
122 vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency); 122 vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency);