From c44a8e9f925c0195c4754c5e763af06dae657b53 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 25 Jan 2013 10:17:20 -0800 Subject: BulletSim: finish the post step event for physical object actions. Modify vehicle to use post step event for logging. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 8b00a33..99903f5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -527,9 +527,15 @@ public sealed class BSPrim : BSPhysObject // If an active vehicle, register the vehicle code to be called before each step if (_vehicle.Type == Vehicle.TYPE_NONE) + { UnRegisterPreStepAction("BSPrim.Vehicle", LocalID); + PhysicsScene.AfterStep -= _vehicle.PostStep; + } else + { RegisterPreStepAction("BSPrim.Vehicle", LocalID, _vehicle.Step); + PhysicsScene.AfterStep += _vehicle.PostStep; + } }); } } -- cgit v1.1 From ddef8f16e58471d19baa63f14134b25309cf2570 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 25 Jan 2013 16:00:17 -0800 Subject: BulletSim: first attempt at reporting top colliders --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 99903f5..17fddd7 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -59,7 +59,6 @@ public sealed class BSPrim : BSPhysObject private OMV.Vector3 _force; private OMV.Vector3 _velocity; private OMV.Vector3 _torque; - private float _collisionScore; private OMV.Vector3 _acceleration; private OMV.Quaternion _orientation; private int _physicsActorType; @@ -644,11 +643,6 @@ public sealed class BSPrim : BSPhysObject // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); } } - public override float CollisionScore { - get { return _collisionScore; } - set { _collisionScore = value; - } - } public override OMV.Vector3 Acceleration { get { return _acceleration; } set { _acceleration = value; } -- cgit v1.1 From 26d4596080295d7509ef16bce9eb571d326c3ba6 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 27 Jan 2013 12:48:16 -0800 Subject: BulletSim: reinstate the supression of rotational velocity for vehicles --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 17fddd7..998836c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1620,7 +1620,7 @@ public sealed class BSPrim : BSPhysObject // TODO: handle physics introduced by Bullet with computed vehicle physics. if (_vehicle.IsActive) { - // entprop.RotationalVelocity = OMV.Vector3.Zero; + entprop.RotationalVelocity = OMV.Vector3.Zero; } // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG -- cgit v1.1 From 531d0429d1cc49a1959f6f7a0028ed3111dd6bd4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 28 Jan 2013 17:08:34 -0800 Subject: BulletSim: first unit test: vehicle angular attraction --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 998836c..2b0a539 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -73,7 +73,7 @@ public sealed class BSPrim : BSPhysObject private bool _kinematic; private float _buoyancy; - private BSDynamics _vehicle; + public BSDynamics VehicleController { get; private set; } private BSVMotor _targetMotor; private OMV.Vector3 _PIDTarget; @@ -107,7 +107,7 @@ public sealed class BSPrim : BSPhysObject _friction = PhysicsScene.Params.defaultFriction; _restitution = PhysicsScene.Params.defaultRestitution; - _vehicle = new BSDynamics(PhysicsScene, this); // add vehicleness + VehicleController = new BSDynamics(PhysicsScene, this); // add vehicleness _mass = CalculateMass(); @@ -512,7 +512,7 @@ public sealed class BSPrim : BSPhysObject public override int VehicleType { get { - return (int)_vehicle.Type; // if we are a vehicle, return that type + return (int)VehicleController.Type; // if we are a vehicle, return that type } set { Vehicle type = (Vehicle)value; @@ -521,19 +521,19 @@ public sealed class BSPrim : BSPhysObject { // Done at taint time so we're sure the physics engine is not using the variables // Vehicle code changes the parameters for this vehicle type. - _vehicle.ProcessTypeChange(type); + VehicleController.ProcessTypeChange(type); ActivateIfPhysical(false); // If an active vehicle, register the vehicle code to be called before each step - if (_vehicle.Type == Vehicle.TYPE_NONE) + if (VehicleController.Type == Vehicle.TYPE_NONE) { UnRegisterPreStepAction("BSPrim.Vehicle", LocalID); - PhysicsScene.AfterStep -= _vehicle.PostStep; + PhysicsScene.AfterStep -= VehicleController.PostStep; } else { - RegisterPreStepAction("BSPrim.Vehicle", LocalID, _vehicle.Step); - PhysicsScene.AfterStep += _vehicle.PostStep; + RegisterPreStepAction("BSPrim.Vehicle", LocalID, VehicleController.Step); + PhysicsScene.AfterStep += VehicleController.PostStep; } }); } @@ -542,7 +542,7 @@ public sealed class BSPrim : BSPhysObject { PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() { - _vehicle.ProcessFloatVehicleParam((Vehicle)param, value); + VehicleController.ProcessFloatVehicleParam((Vehicle)param, value); ActivateIfPhysical(false); }); } @@ -550,7 +550,7 @@ public sealed class BSPrim : BSPhysObject { PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() { - _vehicle.ProcessVectorVehicleParam((Vehicle)param, value); + VehicleController.ProcessVectorVehicleParam((Vehicle)param, value); ActivateIfPhysical(false); }); } @@ -558,7 +558,7 @@ public sealed class BSPrim : BSPhysObject { PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() { - _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); + VehicleController.ProcessRotationVehicleParam((Vehicle)param, rotation); ActivateIfPhysical(false); }); } @@ -566,7 +566,7 @@ public sealed class BSPrim : BSPhysObject { PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() { - _vehicle.ProcessVehicleFlags(param, remove); + VehicleController.ProcessVehicleFlags(param, remove); }); } @@ -747,7 +747,7 @@ public sealed class BSPrim : BSPhysObject // isSolid: other objects bounce off of this object // isVolumeDetect: other objects pass through but can generate collisions // collisionEvents: whether this object returns collision events - private void UpdatePhysicalParameters() + public void UpdatePhysicalParameters() { // DetailLog("{0},BSPrim.UpdatePhysicalParameters,entry,body={1},shape={2}", LocalID, BSBody, BSShape); @@ -759,7 +759,7 @@ public sealed class BSPrim : BSPhysObject MakeDynamic(IsStatic); // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters) - _vehicle.Refresh(); + VehicleController.Refresh(); // Arrange for collision events if the simulator wants them EnableCollisions(SubscribedEvents()); @@ -1601,7 +1601,7 @@ public sealed class BSPrim : BSPhysObject // Remove all the physical dependencies on the old body. // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...) Linkset.RemoveBodyDependencies(this); - _vehicle.RemoveBodyDependencies(this); + VehicleController.RemoveBodyDependencies(this); }); // Make sure the properties are set on the new object @@ -1618,7 +1618,7 @@ public sealed class BSPrim : BSPhysObject { // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet // TODO: handle physics introduced by Bullet with computed vehicle physics. - if (_vehicle.IsActive) + if (VehicleController.IsActive) { entprop.RotationalVelocity = OMV.Vector3.Zero; } -- cgit v1.1 From a61ecee227450ea81c9afe85a62b207fefa888a9 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 29 Jan 2013 17:01:27 -0800 Subject: BulletSim: fix physics repositioning when under ground to only happen for physical objects. Non-physical objects can go anywhere they want. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 2b0a539..b5dd131 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -344,6 +344,10 @@ public sealed class BSPrim : BSPhysObject { bool ret = false; + // We don't care where non-physical items are placed + if (!IsPhysicallyActive) + return ret; + if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition)) { // The physical object is out of the known/simulated area. @@ -1643,7 +1647,7 @@ public sealed class BSPrim : BSPhysObject // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG // The sanity check can change the velocity and/or position. - if (IsPhysical && PositionSanityCheck(true /* inTaintTime */ )) + if (PositionSanityCheck(true /* inTaintTime */ )) { entprop.Position = _position; entprop.Velocity = _velocity; -- cgit v1.1