Revert "Revert "BulletSim: only create vehicle prim actor when vehicles are enabled.""
Found that the vehicle movement problem was not caused by these physics changes.
This reverts commit 5f7b2ea81b
.
TeleportWork
parent
aec8852af7
commit
b14156aa63
|
@ -96,7 +96,7 @@ public class BSPrim : BSPhysObject
|
||||||
_isVolumeDetect = false;
|
_isVolumeDetect = false;
|
||||||
|
|
||||||
// Add a dynamic vehicle to our set of actors that can move this prim.
|
// 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();
|
_mass = CalculateMass();
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ public class BSPrim : BSPhysObject
|
||||||
|
|
||||||
// Find and return a handle to the current vehicle actor.
|
// Find and return a handle to the current vehicle actor.
|
||||||
// Return 'null' if there is no vehicle actor.
|
// Return 'null' if there is no vehicle actor.
|
||||||
public BSDynamics GetVehicleActor()
|
public BSDynamics GetVehicleActor(bool createIfNone)
|
||||||
{
|
{
|
||||||
BSDynamics ret = null;
|
BSDynamics ret = null;
|
||||||
BSActor actor;
|
BSActor actor;
|
||||||
|
@ -505,13 +505,21 @@ public class BSPrim : BSPhysObject
|
||||||
{
|
{
|
||||||
ret = actor as BSDynamics;
|
ret = actor as BSDynamics;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (createIfNone)
|
||||||
|
{
|
||||||
|
ret = new BSDynamics(PhysScene, this, VehicleActorName);
|
||||||
|
PhysicalActors.Add(ret.ActorName, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int VehicleType {
|
public override int VehicleType {
|
||||||
get {
|
get {
|
||||||
int ret = (int)Vehicle.TYPE_NONE;
|
int ret = (int)Vehicle.TYPE_NONE;
|
||||||
BSDynamics vehicleActor = GetVehicleActor();
|
BSDynamics vehicleActor = GetVehicleActor(false /* createIfNone */);
|
||||||
if (vehicleActor != null)
|
if (vehicleActor != null)
|
||||||
ret = (int)vehicleActor.Type;
|
ret = (int)vehicleActor.Type;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -525,12 +533,25 @@ public class BSPrim : BSPhysObject
|
||||||
// change all the parameters. Like a plane changing to CAR when on the
|
// change all the parameters. Like a plane changing to CAR when on the
|
||||||
// ground. In this case, don't want to zero motion.
|
// ground. In this case, don't want to zero motion.
|
||||||
// ZeroMotion(true /* inTaintTime */);
|
// ZeroMotion(true /* inTaintTime */);
|
||||||
BSDynamics vehicleActor = GetVehicleActor();
|
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
|
||||||
|
{
|
||||||
|
// Vehicle type is not 'none' so create an actor and set it running.
|
||||||
|
BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
|
||||||
if (vehicleActor != null)
|
if (vehicleActor != null)
|
||||||
{
|
{
|
||||||
vehicleActor.ProcessTypeChange(type);
|
vehicleActor.ProcessTypeChange(type);
|
||||||
ActivateIfPhysical(false);
|
ActivateIfPhysical(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,7 +559,7 @@ public class BSPrim : BSPhysObject
|
||||||
{
|
{
|
||||||
PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
|
PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
|
||||||
{
|
{
|
||||||
BSDynamics vehicleActor = GetVehicleActor();
|
BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
|
||||||
if (vehicleActor != null)
|
if (vehicleActor != null)
|
||||||
{
|
{
|
||||||
vehicleActor.ProcessFloatVehicleParam((Vehicle)param, value);
|
vehicleActor.ProcessFloatVehicleParam((Vehicle)param, value);
|
||||||
|
@ -550,7 +571,7 @@ public class BSPrim : BSPhysObject
|
||||||
{
|
{
|
||||||
PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
|
PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
|
||||||
{
|
{
|
||||||
BSDynamics vehicleActor = GetVehicleActor();
|
BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
|
||||||
if (vehicleActor != null)
|
if (vehicleActor != null)
|
||||||
{
|
{
|
||||||
vehicleActor.ProcessVectorVehicleParam((Vehicle)param, value);
|
vehicleActor.ProcessVectorVehicleParam((Vehicle)param, value);
|
||||||
|
@ -562,7 +583,7 @@ public class BSPrim : BSPhysObject
|
||||||
{
|
{
|
||||||
PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
|
PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
|
||||||
{
|
{
|
||||||
BSDynamics vehicleActor = GetVehicleActor();
|
BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
|
||||||
if (vehicleActor != null)
|
if (vehicleActor != null)
|
||||||
{
|
{
|
||||||
vehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation);
|
vehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation);
|
||||||
|
@ -574,7 +595,7 @@ public class BSPrim : BSPhysObject
|
||||||
{
|
{
|
||||||
PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate()
|
PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate()
|
||||||
{
|
{
|
||||||
BSDynamics vehicleActor = GetVehicleActor();
|
BSDynamics vehicleActor = GetVehicleActor(true /* createIfNone */);
|
||||||
if (vehicleActor != null)
|
if (vehicleActor != null)
|
||||||
{
|
{
|
||||||
vehicleActor.ProcessVehicleFlags(param, remove);
|
vehicleActor.ProcessVehicleFlags(param, remove);
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class BasicVehicles : OpenSimTestCase
|
||||||
// Instead the appropriate values are set and calls are made just the parts of the
|
// 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
|
// controller we want to exercise. Stepping the physics engine then applies
|
||||||
// the actions of that one feature.
|
// the actions of that one feature.
|
||||||
BSDynamics vehicleActor = TestVehicle.GetVehicleActor();
|
BSDynamics vehicleActor = TestVehicle.GetVehicleActor(true /* createIfNone */);
|
||||||
if (vehicleActor != null)
|
if (vehicleActor != null)
|
||||||
{
|
{
|
||||||
vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency);
|
vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency);
|
||||||
|
|
Loading…
Reference in New Issue