aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs43
1 files changed, 11 insertions, 32 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);