aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs62
1 files changed, 28 insertions, 34 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 81e2ea3..4d0699b 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -99,49 +99,43 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
99 { 99 {
100 foreach (BasicActor actor in _actors) 100 foreach (BasicActor actor in _actors)
101 { 101 {
102 if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) 102 float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f;
103 { 103 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
104 float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f; 104 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
105 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); 105 if (actor.Flying)
106 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
107 if (actor.Flying)
108 { 106 {
109 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < 107 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
110 _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
111 {
112 actor.Position.Z = height;
113 actor.Velocity.Z = 0;
114 }
115 else
116 {
117 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
118 }
119 }
120 else
121 { 108 {
122 actor.Position.Z = height; 109 actor.Position.Z = height;
123 actor.Velocity.Z = 0; 110 actor.Velocity.Z = 0;
124 } 111 }
112 else
113 {
114 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
115 }
125 } 116 }
126 else 117 else
127 { 118 {
128 if (actor.Position.Y < 0) 119 actor.Position.Z = height;
129 { 120 actor.Velocity.Z = 0;
130 actor.Position.Y = 0; 121 }
131 }
132 else if (actor.Position.Y > 256)
133 {
134 actor.Position.Y = 256;
135 }
136 122
137 if (actor.Position.X < 0) 123 if (actor.Position.Y < 0)
138 { 124 {
139 actor.Position.X = 0; 125 actor.Position.Y = 0;
140 } 126 }
141 if (actor.Position.X > 256) 127 else if (actor.Position.Y > 256)
142 { 128 {
143 actor.Position.X = 256; 129 actor.Position.Y = 256;
144 } 130 }
131
132 if (actor.Position.X < 0)
133 {
134 actor.Position.X = 0;
135 }
136 if (actor.Position.X > 256)
137 {
138 actor.Position.X = 256;
145 } 139 }
146 } 140 }
147 } 141 }