diff options
Diffstat (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 106 |
1 files changed, 29 insertions, 77 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 95e6095..b412818 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -39,7 +39,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
39 | { | 39 | { |
40 | public BasicPhysicsPlugin() | 40 | public BasicPhysicsPlugin() |
41 | { | 41 | { |
42 | |||
43 | } | 42 | } |
44 | 43 | ||
45 | public bool Init() | 44 | public bool Init() |
@@ -59,7 +58,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
59 | 58 | ||
60 | public void Dispose() | 59 | public void Dispose() |
61 | { | 60 | { |
62 | |||
63 | } | 61 | } |
64 | } | 62 | } |
65 | 63 | ||
@@ -70,7 +68,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
70 | 68 | ||
71 | public BasicScene() | 69 | public BasicScene() |
72 | { | 70 | { |
73 | |||
74 | } | 71 | } |
75 | 72 | ||
76 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) | 73 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) |
@@ -83,17 +80,15 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
83 | 80 | ||
84 | public override void RemovePrim(PhysicsActor prim) | 81 | public override void RemovePrim(PhysicsActor prim) |
85 | { | 82 | { |
86 | |||
87 | } | 83 | } |
88 | 84 | ||
89 | public override void RemoveAvatar(PhysicsActor actor) | 85 | public override void RemoveAvatar(PhysicsActor actor) |
90 | { | 86 | { |
91 | BasicActor act = (BasicActor)actor; | 87 | BasicActor act = (BasicActor) actor; |
92 | if (_actors.Contains(act)) | 88 | if (_actors.Contains(act)) |
93 | { | 89 | { |
94 | _actors.Remove(act); | 90 | _actors.Remove(act); |
95 | } | 91 | } |
96 | |||
97 | } | 92 | } |
98 | 93 | ||
99 | /* | 94 | /* |
@@ -102,7 +97,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
102 | return null; | 97 | return null; |
103 | } | 98 | } |
104 | */ | 99 | */ |
105 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) | 100 | |
101 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | ||
102 | PhysicsVector size, Quaternion rotation) | ||
106 | { | 103 | { |
107 | return null; | 104 | return null; |
108 | } | 105 | } |
@@ -112,8 +109,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
112 | { | 109 | { |
113 | foreach (BasicActor actor in _actors) | 110 | foreach (BasicActor actor in _actors) |
114 | { | 111 | { |
115 | actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); | 112 | actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep); |
116 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); | 113 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep); |
117 | if (actor.Position.Y < 0) | 114 | if (actor.Position.Y < 0) |
118 | { | 115 | { |
119 | actor.Position.Y = 0.1F; | 116 | actor.Position.Y = 0.1F; |
@@ -132,17 +129,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
132 | actor.Position.X = 255.9F; | 129 | actor.Position.X = 255.9F; |
133 | } | 130 | } |
134 | 131 | ||
135 | float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.0f; | 132 | float height = _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 1.0f; |
136 | if (actor.Flying) | 133 | if (actor.Flying) |
137 | { | 134 | { |
138 | if (actor.Position.Z + (actor.Velocity.Z * timeStep) < _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2) | 135 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < |
136 | _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 2) | ||
139 | { | 137 | { |
140 | actor.Position.Z = height; | 138 | actor.Position.Z = height; |
141 | actor.Velocity.Z = 0; | 139 | actor.Velocity.Z = 0; |
142 | } | 140 | } |
143 | else | 141 | else |
144 | { | 142 | { |
145 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | 143 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z*timeStep); |
146 | } | 144 | } |
147 | } | 145 | } |
148 | else | 146 | else |
@@ -150,32 +148,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
150 | actor.Position.Z = height; | 148 | actor.Position.Z = height; |
151 | actor.Velocity.Z = 0; | 149 | actor.Velocity.Z = 0; |
152 | } | 150 | } |
153 | |||
154 | |||
155 | } | 151 | } |
156 | } | 152 | } |
157 | 153 | ||
158 | public override void GetResults() | 154 | public override void GetResults() |
159 | { | 155 | { |
160 | |||
161 | } | 156 | } |
162 | 157 | ||
163 | public override bool IsThreaded | 158 | public override bool IsThreaded |
164 | { | 159 | { |
165 | get | 160 | get { return (false); // for now we won't be multithreaded |
166 | { | ||
167 | return (false); // for now we won't be multithreaded | ||
168 | } | 161 | } |
169 | } | 162 | } |
170 | 163 | ||
171 | public override void SetTerrain(float[] heightMap) | 164 | public override void SetTerrain(float[] heightMap) |
172 | { | 165 | { |
173 | this._heightMap = heightMap; | 166 | _heightMap = heightMap; |
174 | } | 167 | } |
175 | 168 | ||
176 | public override void DeleteTerrain() | 169 | public override void DeleteTerrain() |
177 | { | 170 | { |
178 | |||
179 | } | 171 | } |
180 | } | 172 | } |
181 | 173 | ||
@@ -185,6 +177,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
185 | private PhysicsVector _velocity; | 177 | private PhysicsVector _velocity; |
186 | private PhysicsVector _acceleration; | 178 | private PhysicsVector _acceleration; |
187 | private bool flying; | 179 | private bool flying; |
180 | |||
188 | public BasicActor() | 181 | public BasicActor() |
189 | { | 182 | { |
190 | _velocity = new PhysicsVector(); | 183 | _velocity = new PhysicsVector(); |
@@ -194,97 +187,56 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
194 | 187 | ||
195 | public override bool Flying | 188 | public override bool Flying |
196 | { | 189 | { |
197 | get | 190 | get { return flying; } |
198 | { | 191 | set { flying = value; } |
199 | return flying; | ||
200 | } | ||
201 | set | ||
202 | { | ||
203 | flying = value; | ||
204 | } | ||
205 | } | 192 | } |
206 | 193 | ||
207 | public override PhysicsVector Position | 194 | public override PhysicsVector Position |
208 | { | 195 | { |
209 | get | 196 | get { return _position; } |
210 | { | 197 | set { _position = value; } |
211 | return _position; | ||
212 | } | ||
213 | set | ||
214 | { | ||
215 | _position = value; | ||
216 | } | ||
217 | } | 198 | } |
218 | 199 | ||
219 | public override PhysicsVector Size | 200 | public override PhysicsVector Size |
220 | { | 201 | { |
221 | get | 202 | get { return new PhysicsVector(0, 0, 0); } |
222 | { | 203 | set { } |
223 | return new PhysicsVector(0, 0, 0); | ||
224 | } | ||
225 | set | ||
226 | { | ||
227 | } | ||
228 | } | 204 | } |
229 | 205 | ||
230 | public override PhysicsVector Velocity | 206 | public override PhysicsVector Velocity |
231 | { | 207 | { |
232 | get | 208 | get { return _velocity; } |
233 | { | 209 | set { _velocity = value; } |
234 | return _velocity; | ||
235 | } | ||
236 | set | ||
237 | { | ||
238 | _velocity = value; | ||
239 | } | ||
240 | } | 210 | } |
241 | 211 | ||
242 | public override Quaternion Orientation | 212 | public override Quaternion Orientation |
243 | { | 213 | { |
244 | get | 214 | get { return Quaternion.Identity; } |
245 | { | 215 | set { } |
246 | return Quaternion.Identity; | ||
247 | } | ||
248 | set | ||
249 | { | ||
250 | |||
251 | } | ||
252 | } | 216 | } |
253 | 217 | ||
254 | public override PhysicsVector Acceleration | 218 | public override PhysicsVector Acceleration |
255 | { | 219 | { |
256 | get | 220 | get { return _acceleration; } |
257 | { | ||
258 | return _acceleration; | ||
259 | } | ||
260 | |||
261 | } | 221 | } |
262 | 222 | ||
263 | public override bool Kinematic | 223 | public override bool Kinematic |
264 | { | 224 | { |
265 | get | 225 | get { return true; } |
266 | { | 226 | set { } |
267 | return true; | ||
268 | } | ||
269 | set | ||
270 | { | ||
271 | |||
272 | } | ||
273 | } | 227 | } |
228 | |||
274 | public void SetAcceleration(PhysicsVector accel) | 229 | public void SetAcceleration(PhysicsVector accel) |
275 | { | 230 | { |
276 | this._acceleration = accel; | 231 | _acceleration = accel; |
277 | } | 232 | } |
278 | 233 | ||
279 | public override void AddForce(PhysicsVector force) | 234 | public override void AddForce(PhysicsVector force) |
280 | { | 235 | { |
281 | |||
282 | } | 236 | } |
283 | 237 | ||
284 | public override void SetMomentum(PhysicsVector momentum) | 238 | public override void SetMomentum(PhysicsVector momentum) |
285 | { | 239 | { |
286 | |||
287 | } | 240 | } |
288 | } | 241 | } |
289 | 242 | } \ No newline at end of file | |
290 | } | ||