diff options
Diffstat (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 6c9d9ab..1ceed1a 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -123,11 +123,15 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
123 | actorPosition.X = ((int)Constants.RegionSize - 0.1f); | 123 | actorPosition.X = ((int)Constants.RegionSize - 0.1f); |
124 | } | 124 | } |
125 | 125 | ||
126 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; | 126 | float terrainHeight = 0; |
127 | if (_heightMap != null) | ||
128 | terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X]; | ||
129 | |||
130 | float height = terrainHeight + actor.Size.Z; | ||
131 | |||
127 | if (actor.Flying) | 132 | if (actor.Flying) |
128 | { | 133 | { |
129 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < | 134 | if (actor.Position.Z + (actor.Velocity.Z * timeStep) < terrainHeight + 2) |
130 | _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) | ||
131 | { | 135 | { |
132 | actorPosition.Z = height; | 136 | actorPosition.Z = height; |
133 | actorVelocity.Z = 0; | 137 | actorVelocity.Z = 0; |
@@ -135,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
135 | } | 139 | } |
136 | else | 140 | else |
137 | { | 141 | { |
138 | actorPosition.Z += actor.Velocity.Z*timeStep; | 142 | actorPosition.Z += actor.Velocity.Z * timeStep; |
139 | actor.IsColliding = false; | 143 | actor.IsColliding = false; |
140 | } | 144 | } |
141 | } | 145 | } |