From 5f7b2ea81b95a60e882bc65b663a2c9fe134f92a Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 22 Jul 2013 12:08:49 -0700 Subject: 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. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 43 ++++++---------------- .../Physics/BulletSPlugin/Tests/BasicVehicles.cs | 2 +- 2 files changed, 12 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/Physics') 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 _isVolumeDetect = false; // Add a dynamic vehicle to our set of actors that can move this prim. - // PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysScene, this, VehicleActorName)); + PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysScene, this, VehicleActorName)); _mass = CalculateMass(); @@ -497,7 +497,7 @@ public class BSPrim : BSPhysObject // Find and return a handle to the current vehicle actor. // Return 'null' if there is no vehicle actor. - public BSDynamics GetVehicleActor(bool createIfNone) + public BSDynamics GetVehicleActor() { BSDynamics ret = null; BSActor actor; @@ -505,21 +505,13 @@ public class BSPrim : BSPhysObject { ret = actor as BSDynamics; } - else - { - if (createIfNone) - { - ret = new BSDynamics(PhysScene, this, VehicleActorName); - PhysicalActors.Add(ret.ActorName, ret); - } - } return ret; } public override int VehicleType { get { int ret = (int)Vehicle.TYPE_NONE; - BSDynamics vehicleActor = GetVehicleActor(false /* createIfNone */); + BSDynamics vehicleActor = GetVehicleActor(); if (vehicleActor != null) ret = (int)vehicleActor.Type; return ret; @@ -533,24 +525,11 @@ public class BSPrim : BSPhysObject // change all the parameters. Like a plane changing to CAR when on the // ground. In this case, don't want to zero motion. // ZeroMotion(true /* inTaintTime */); - if (type == Vehicle.TYPE_NONE) - { - // Vehicle type is 'none' so get rid of any actor that may have been allocated. - BSDynamics vehicleActor = GetVehicleActor(false /* createIfNone */); - if (vehicleActor != null) - { - PhysicalActors.RemoveAndRelease(vehicleActor.ActorName); - } - } - else + BSDynamics vehicleActor = GetVehicleActor(); + if (vehicleActor != null) { - // Vehicle type is not 'none' so create an actor and set it running. - BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); - if (vehicleActor != null) - { - vehicleActor.ProcessTypeChange(type); - ActivateIfPhysical(false); - } + vehicleActor.ProcessTypeChange(type); + ActivateIfPhysical(false); } }); } @@ -559,7 +538,7 @@ public class BSPrim : BSPhysObject { PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() { - BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); + BSDynamics vehicleActor = GetVehicleActor(); if (vehicleActor != null) { vehicleActor.ProcessFloatVehicleParam((Vehicle)param, value); @@ -571,7 +550,7 @@ public class BSPrim : BSPhysObject { PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() { - BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); + BSDynamics vehicleActor = GetVehicleActor(); if (vehicleActor != null) { vehicleActor.ProcessVectorVehicleParam((Vehicle)param, value); @@ -583,7 +562,7 @@ public class BSPrim : BSPhysObject { PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() { - BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); + BSDynamics vehicleActor = GetVehicleActor(); if (vehicleActor != null) { vehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation); @@ -595,7 +574,7 @@ public class BSPrim : BSPhysObject { PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate() { - BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */); + BSDynamics vehicleActor = GetVehicleActor(); if (vehicleActor != null) { 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 // Instead the appropriate values are set and calls are made just the parts of the // controller we want to exercise. Stepping the physics engine then applies // the actions of that one feature. - BSDynamics vehicleActor = TestVehicle.GetVehicleActor(true /* createIfNone */); + BSDynamics vehicleActor = TestVehicle.GetVehicleActor(); if (vehicleActor != null) { vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency); -- cgit v1.1