diff options
fixed potential reference invalidation and array out of bounds exception in basicphysics
Diffstat (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index a7f7877..eb9590a 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -120,8 +120,10 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
120 | } | 120 | } |
121 | public override void Simulate(float timeStep) | 121 | public override void Simulate(float timeStep) |
122 | { | 122 | { |
123 | foreach (BasicActor actor in _actors) | 123 | for (int i = 0; i < _actors.Count; ++i) |
124 | { | 124 | { |
125 | BasicActor actor = _actors[i]; | ||
126 | |||
125 | actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep); | 127 | actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep); |
126 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep); | 128 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep); |
127 | if (actor.Position.Y < 0) | 129 | if (actor.Position.Y < 0) |
@@ -137,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
137 | { | 139 | { |
138 | actor.Position.X = 0.1F; | 140 | actor.Position.X = 0.1F; |
139 | } | 141 | } |
140 | else if (actor.Position.X > 256) | 142 | else if (actor.Position.X >= 256) |
141 | { | 143 | { |
142 | actor.Position.X = 255.9F; | 144 | actor.Position.X = 255.9F; |
143 | } | 145 | } |