diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 0c80611..f72bd74 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -96,6 +96,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
96 | public long SimulationStep { get { return m_simulationStep; } } | 96 | public long SimulationStep { get { return m_simulationStep; } } |
97 | private int m_taintsToProcessPerStep; | 97 | private int m_taintsToProcessPerStep; |
98 | 98 | ||
99 | public delegate void PreStepAction(float timeStep); | ||
100 | public event PreStepAction BeforeStep; | ||
101 | |||
99 | // A value of the time now so all the collision and update routines do not have to get their own | 102 | // A value of the time now so all the collision and update routines do not have to get their own |
100 | // Set to 'now' just before all the prims and actors are called for collisions and updates | 103 | // Set to 'now' just before all the prims and actors are called for collisions and updates |
101 | public int SimulationNowTime { get; private set; } | 104 | public int SimulationNowTime { get; private set; } |
@@ -487,8 +490,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
487 | ProcessTaints(); | 490 | ProcessTaints(); |
488 | 491 | ||
489 | // Some of the prims operate with special vehicle properties | 492 | // Some of the prims operate with special vehicle properties |
490 | ProcessVehicles(timeStep); | 493 | DoPreStepActions(timeStep); |
491 | ProcessTaints(); // the vehicles might have added taints | 494 | |
495 | // the prestep actions might have added taints | ||
496 | ProcessTaints(); | ||
492 | 497 | ||
493 | // step the physical world one interval | 498 | // step the physical world one interval |
494 | m_simulationStep++; | 499 | m_simulationStep++; |
@@ -496,7 +501,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
496 | 501 | ||
497 | try | 502 | try |
498 | { | 503 | { |
499 | // if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG | 504 | if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG |
500 | if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount(); | 505 | if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount(); |
501 | 506 | ||
502 | numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep, | 507 | numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep, |
@@ -505,7 +510,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
505 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); | 510 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); |
506 | DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}", | 511 | DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}", |
507 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); | 512 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); |
508 | // if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG | 513 | if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG |
509 | } | 514 | } |
510 | catch (Exception e) | 515 | catch (Exception e) |
511 | { | 516 | { |
@@ -907,6 +912,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
907 | } | 912 | } |
908 | } | 913 | } |
909 | 914 | ||
915 | private void DoPreStepActions(float timeStep) | ||
916 | { | ||
917 | ProcessVehicles(timeStep); | ||
918 | |||
919 | PreStepAction actions = BeforeStep; | ||
920 | if (actions != null) | ||
921 | actions(timeStep); | ||
922 | |||
923 | } | ||
924 | |||
910 | // Some prims have extra vehicle actions | 925 | // Some prims have extra vehicle actions |
911 | // Called at taint time! | 926 | // Called at taint time! |
912 | private void ProcessVehicles(float timeStep) | 927 | private void ProcessVehicles(float timeStep) |
@@ -971,6 +986,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
971 | // Should handle fetching the right type from the ini file and converting it. | 986 | // Should handle fetching the right type from the ini file and converting it. |
972 | // -- a delegate for getting the value as a float | 987 | // -- a delegate for getting the value as a float |
973 | // -- a delegate for setting the value from a float | 988 | // -- a delegate for setting the value from a float |
989 | // -- an optional delegate to update the value in the world. Most often used to | ||
990 | // push the new value to an in-world object. | ||
974 | // | 991 | // |
975 | // The single letter parameters for the delegates are: | 992 | // The single letter parameters for the delegates are: |
976 | // s = BSScene | 993 | // s = BSScene |