diff options
author | lbsa71 | 2007-12-27 21:41:48 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-27 21:41:48 +0000 |
commit | efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch) | |
tree | bf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Physics/POSPlugin | |
parent | * removed always true if (diff) | |
download | opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2 opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz |
* Optimized usings
* shortened references
* Removed redundant 'this'
* Normalized EOF
Diffstat (limited to 'OpenSim/Region/Physics/POSPlugin')
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 84 |
2 files changed, 52 insertions, 34 deletions
diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs index da9f587..3bb71d4 100644 --- a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs | |||
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices; | |||
55 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
56 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
57 | 57 | ||
58 | [assembly : AssemblyVersion("1.0.*")] | 58 | [assembly : AssemblyVersion("1.0.*")] \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 26310f9..1bc3490 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -25,8 +25,8 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | ||
29 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using Axiom.Math; | 30 | using Axiom.Math; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
@@ -114,10 +114,10 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
114 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 114 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, |
115 | PhysicsVector size, Quaternion rotation) | 115 | PhysicsVector size, Quaternion rotation) |
116 | { | 116 | { |
117 | return this.AddPrimShape(primName, pbs, position, size, rotation, false); | 117 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
118 | } | 118 | } |
119 | 119 | ||
120 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 120 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, |
121 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 121 | PhysicsVector size, Quaternion rotation, bool isPhysical) |
122 | { | 122 | { |
123 | POSPrim prim = new POSPrim(); | 123 | POSPrim prim = new POSPrim(); |
@@ -136,18 +136,20 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
136 | " sizeX: " + p.Size.X * 0.5 + 0.5); | 136 | " sizeX: " + p.Size.X * 0.5 + 0.5); |
137 | */ | 137 | */ |
138 | 138 | ||
139 | Vector3 rotatedPos = p.Orientation.Inverse() * new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y, c.Position.Z - p.Position.Z); | 139 | Vector3 rotatedPos = p.Orientation.Inverse()* |
140 | Vector3 avatarSize = p.Orientation.Inverse() * new Vector3(c.Size.X, c.Size.Y, c.Size.Z); | 140 | new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y, |
141 | c.Position.Z - p.Position.Z); | ||
142 | Vector3 avatarSize = p.Orientation.Inverse()*new Vector3(c.Size.X, c.Size.Y, c.Size.Z); | ||
141 | 143 | ||
142 | if (Math.Abs(rotatedPos.x) >= (p.Size.X * 0.5 + Math.Abs(avatarSize.x))) | 144 | if (Math.Abs(rotatedPos.x) >= (p.Size.X*0.5 + Math.Abs(avatarSize.x))) |
143 | { | 145 | { |
144 | return false; | 146 | return false; |
145 | } | 147 | } |
146 | if (Math.Abs(rotatedPos.y) >= (p.Size.Y * 0.5 + Math.Abs(avatarSize.y))) | 148 | if (Math.Abs(rotatedPos.y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.y))) |
147 | { | 149 | { |
148 | return false; | 150 | return false; |
149 | } | 151 | } |
150 | if (Math.Abs(rotatedPos.z) >= (p.Size.Z * 0.5 + Math.Abs(avatarSize.z))) | 152 | if (Math.Abs(rotatedPos.z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.z))) |
151 | { | 153 | { |
152 | return false; | 154 | return false; |
153 | } | 155 | } |
@@ -182,12 +184,12 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
182 | 184 | ||
183 | if (!character.Flying) | 185 | if (!character.Flying) |
184 | { | 186 | { |
185 | character._target_velocity.Z += gravity * timeStep; | 187 | character._target_velocity.Z += gravity*timeStep; |
186 | } | 188 | } |
187 | 189 | ||
188 | bool forcedZ = false; | 190 | bool forcedZ = false; |
189 | character.Position.X += character._target_velocity.X * timeStep; | 191 | character.Position.X += character._target_velocity.X*timeStep; |
190 | character.Position.Y += character._target_velocity.Y * timeStep; | 192 | character.Position.Y += character._target_velocity.Y*timeStep; |
191 | 193 | ||
192 | if (character.Position.Y < 0) | 194 | if (character.Position.Y < 0) |
193 | { | 195 | { |
@@ -207,15 +209,15 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
207 | character.Position.X = 255.9F; | 209 | character.Position.X = 255.9F; |
208 | } | 210 | } |
209 | 211 | ||
210 | float terrainheight = _heightMap[(int)character.Position.Y * 256 + (int)character.Position.X]; | 212 | float terrainheight = _heightMap[(int) character.Position.Y*256 + (int) character.Position.X]; |
211 | if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) | 213 | if (character.Position.Z + (character._target_velocity.Z*timeStep) < terrainheight + 2) |
212 | { | 214 | { |
213 | character.Position.Z = terrainheight + 1.0f; | 215 | character.Position.Z = terrainheight + 1.0f; |
214 | forcedZ = true; | 216 | forcedZ = true; |
215 | } | 217 | } |
216 | else | 218 | else |
217 | { | 219 | { |
218 | character.Position.Z += character._target_velocity.Z * timeStep; | 220 | character.Position.Z += character._target_velocity.Z*timeStep; |
219 | } | 221 | } |
220 | 222 | ||
221 | /// this is it -- the magic you've all been waiting for! Ladies and gentlemen -- | 223 | /// this is it -- the magic you've all been waiting for! Ladies and gentlemen -- |
@@ -224,21 +226,21 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
224 | 226 | ||
225 | if (check_all_prims(character)) | 227 | if (check_all_prims(character)) |
226 | { | 228 | { |
227 | character.Position.Z = oldposZ; // first try Z axis | 229 | character.Position.Z = oldposZ; // first try Z axis |
228 | if (check_all_prims(character)) | 230 | if (check_all_prims(character)) |
229 | { | 231 | { |
230 | character.Position.Z = oldposZ + 0.4f; // try harder | 232 | character.Position.Z = oldposZ + 0.4f; // try harder |
231 | if (check_all_prims(character)) | 233 | if (check_all_prims(character)) |
232 | { | 234 | { |
233 | character.Position.X = oldposX; | 235 | character.Position.X = oldposX; |
234 | character.Position.Y = oldposY; | 236 | character.Position.Y = oldposY; |
235 | character.Position.Z = oldposZ; | 237 | character.Position.Z = oldposZ; |
236 | character.Position.X = character.Position.X + (character._target_velocity.X * timeStep); | 238 | character.Position.X = character.Position.X + (character._target_velocity.X*timeStep); |
237 | if (check_all_prims(character)) | 239 | if (check_all_prims(character)) |
238 | { | 240 | { |
239 | character.Position.X = oldposX; | 241 | character.Position.X = oldposX; |
240 | } | 242 | } |
241 | character.Position.Y = character.Position.Y + (character._target_velocity.Y * timeStep); | 243 | character.Position.Y = character.Position.Y + (character._target_velocity.Y*timeStep); |
242 | if (check_all_prims(character)) | 244 | if (check_all_prims(character)) |
243 | { | 245 | { |
244 | character.Position.Y = oldposY; | 246 | character.Position.Y = oldposY; |
@@ -253,7 +255,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
253 | { | 255 | { |
254 | forcedZ = true; | 256 | forcedZ = true; |
255 | } | 257 | } |
256 | } | 258 | } |
257 | 259 | ||
258 | if (character.Position.Y < 0) | 260 | if (character.Position.Y < 0) |
259 | { | 261 | { |
@@ -273,8 +275,8 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
273 | character.Position.X = 255.9F; | 275 | character.Position.X = 255.9F; |
274 | } | 276 | } |
275 | 277 | ||
276 | character._velocity.X = (character.Position.X - oldposX) / timeStep; | 278 | character._velocity.X = (character.Position.X - oldposX)/timeStep; |
277 | character._velocity.Y = (character.Position.Y - oldposY) / timeStep; | 279 | character._velocity.Y = (character.Position.Y - oldposY)/timeStep; |
278 | 280 | ||
279 | if (forcedZ) | 281 | if (forcedZ) |
280 | { | 282 | { |
@@ -284,7 +286,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
284 | } | 286 | } |
285 | else | 287 | else |
286 | { | 288 | { |
287 | character._velocity.Z = (character.Position.Z - oldposZ) / timeStep; | 289 | character._velocity.Z = (character.Position.Z - oldposZ)/timeStep; |
288 | } | 290 | } |
289 | } | 291 | } |
290 | return fps; | 292 | return fps; |
@@ -326,31 +328,37 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
326 | _position = new PhysicsVector(); | 328 | _position = new PhysicsVector(); |
327 | _acceleration = new PhysicsVector(); | 329 | _acceleration = new PhysicsVector(); |
328 | } | 330 | } |
331 | |||
329 | public override int PhysicsActorType | 332 | public override int PhysicsActorType |
330 | { | 333 | { |
331 | get { return (int)ActorTypes.Agent; } | 334 | get { return (int) ActorTypes.Agent; } |
332 | set { return; } | 335 | set { return; } |
333 | } | 336 | } |
337 | |||
334 | public override PhysicsVector RotationalVelocity | 338 | public override PhysicsVector RotationalVelocity |
335 | { | 339 | { |
336 | get { return m_rotationalVelocity; } | 340 | get { return m_rotationalVelocity; } |
337 | set { m_rotationalVelocity = value; } | 341 | set { m_rotationalVelocity = value; } |
338 | } | 342 | } |
343 | |||
339 | public override bool SetAlwaysRun | 344 | public override bool SetAlwaysRun |
340 | { | 345 | { |
341 | get { return false; } | 346 | get { return false; } |
342 | set { return; } | 347 | set { return; } |
343 | } | 348 | } |
349 | |||
344 | public override bool IsPhysical | 350 | public override bool IsPhysical |
345 | { | 351 | { |
346 | get { return false; } | 352 | get { return false; } |
347 | set { return; } | 353 | set { return; } |
348 | } | 354 | } |
355 | |||
349 | public override bool ThrottleUpdates | 356 | public override bool ThrottleUpdates |
350 | { | 357 | { |
351 | get { return false; } | 358 | get { return false; } |
352 | set { return; } | 359 | set { return; } |
353 | } | 360 | } |
361 | |||
354 | public override bool Flying | 362 | public override bool Flying |
355 | { | 363 | { |
356 | get { return flying; } | 364 | get { return flying; } |
@@ -362,16 +370,19 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
362 | get { return iscolliding; } | 370 | get { return iscolliding; } |
363 | set { iscolliding = value; } | 371 | set { iscolliding = value; } |
364 | } | 372 | } |
373 | |||
365 | public override bool CollidingGround | 374 | public override bool CollidingGround |
366 | { | 375 | { |
367 | get { return false; } | 376 | get { return false; } |
368 | set { return; } | 377 | set { return; } |
369 | } | 378 | } |
379 | |||
370 | public override bool CollidingObj | 380 | public override bool CollidingObj |
371 | { | 381 | { |
372 | get { return false; } | 382 | get { return false; } |
373 | set { return; } | 383 | set { return; } |
374 | } | 384 | } |
385 | |||
375 | public override PhysicsVector Position | 386 | public override PhysicsVector Position |
376 | { | 387 | { |
377 | get { return _position; } | 388 | get { return _position; } |
@@ -383,18 +394,22 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
383 | get { return new PhysicsVector(0.5f, 0.5f, 1.0f); } | 394 | get { return new PhysicsVector(0.5f, 0.5f, 1.0f); } |
384 | set { } | 395 | set { } |
385 | } | 396 | } |
397 | |||
386 | public override float Mass | 398 | public override float Mass |
387 | { | 399 | { |
388 | get { return 0f; } | 400 | get { return 0f; } |
389 | } | 401 | } |
402 | |||
390 | public override PhysicsVector Force | 403 | public override PhysicsVector Force |
391 | { | 404 | { |
392 | get { return PhysicsVector.Zero; } | 405 | get { return PhysicsVector.Zero; } |
393 | } | 406 | } |
407 | |||
394 | public override PhysicsVector CenterOfMass | 408 | public override PhysicsVector CenterOfMass |
395 | { | 409 | { |
396 | get { return PhysicsVector.Zero; } | 410 | get { return PhysicsVector.Zero; } |
397 | } | 411 | } |
412 | |||
398 | public override PhysicsVector GeometricCenter | 413 | public override PhysicsVector GeometricCenter |
399 | { | 414 | { |
400 | get { return PhysicsVector.Zero; } | 415 | get { return PhysicsVector.Zero; } |
@@ -402,10 +417,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
402 | 417 | ||
403 | public override PrimitiveBaseShape Shape | 418 | public override PrimitiveBaseShape Shape |
404 | { | 419 | { |
405 | set | 420 | set { return; } |
406 | { | ||
407 | return; | ||
408 | } | ||
409 | } | 421 | } |
410 | 422 | ||
411 | public override PhysicsVector Velocity | 423 | public override PhysicsVector Velocity |
@@ -461,41 +473,49 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
461 | _position = new PhysicsVector(); | 473 | _position = new PhysicsVector(); |
462 | _acceleration = new PhysicsVector(); | 474 | _acceleration = new PhysicsVector(); |
463 | } | 475 | } |
476 | |||
464 | public override int PhysicsActorType | 477 | public override int PhysicsActorType |
465 | { | 478 | { |
466 | get { return (int)ActorTypes.Prim; } | 479 | get { return (int) ActorTypes.Prim; } |
467 | set { return; } | 480 | set { return; } |
468 | } | 481 | } |
482 | |||
469 | public override PhysicsVector RotationalVelocity | 483 | public override PhysicsVector RotationalVelocity |
470 | { | 484 | { |
471 | get { return m_rotationalVelocity; } | 485 | get { return m_rotationalVelocity; } |
472 | set { m_rotationalVelocity = value; } | 486 | set { m_rotationalVelocity = value; } |
473 | } | 487 | } |
488 | |||
474 | public override bool IsPhysical | 489 | public override bool IsPhysical |
475 | { | 490 | { |
476 | get { return false; } | 491 | get { return false; } |
477 | set { return; } | 492 | set { return; } |
478 | } | 493 | } |
494 | |||
479 | public override bool ThrottleUpdates | 495 | public override bool ThrottleUpdates |
480 | { | 496 | { |
481 | get { return false; } | 497 | get { return false; } |
482 | set { return; } | 498 | set { return; } |
483 | } | 499 | } |
500 | |||
484 | public override bool IsColliding | 501 | public override bool IsColliding |
485 | { | 502 | { |
486 | get { return iscolliding; } | 503 | get { return iscolliding; } |
487 | set { iscolliding = value; } | 504 | set { iscolliding = value; } |
488 | } | 505 | } |
506 | |||
489 | public override bool CollidingGround | 507 | public override bool CollidingGround |
490 | { | 508 | { |
491 | get { return false; } | 509 | get { return false; } |
492 | set { return; } | 510 | set { return; } |
493 | } | 511 | } |
512 | |||
494 | public override bool CollidingObj | 513 | public override bool CollidingObj |
495 | { | 514 | { |
496 | get { return false; } | 515 | get { return false; } |
497 | set { return; } | 516 | set { return; } |
498 | } | 517 | } |
518 | |||
499 | public override PhysicsVector Position | 519 | public override PhysicsVector Position |
500 | { | 520 | { |
501 | get { return _position; } | 521 | get { return _position; } |
@@ -530,10 +550,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
530 | 550 | ||
531 | public override PrimitiveBaseShape Shape | 551 | public override PrimitiveBaseShape Shape |
532 | { | 552 | { |
533 | set | 553 | set { return; } |
534 | { | ||
535 | return; | ||
536 | } | ||
537 | } | 554 | } |
538 | 555 | ||
539 | public override PhysicsVector Velocity | 556 | public override PhysicsVector Velocity |
@@ -571,6 +588,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
571 | public override void SetMomentum(PhysicsVector momentum) | 588 | public override void SetMomentum(PhysicsVector momentum) |
572 | { | 589 | { |
573 | } | 590 | } |
591 | |||
574 | public override bool Flying | 592 | public override bool Flying |
575 | { | 593 | { |
576 | get { return false; } | 594 | get { return false; } |
@@ -583,4 +601,4 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
583 | set { return; } | 601 | set { return; } |
584 | } | 602 | } |
585 | } | 603 | } |
586 | } | 604 | } \ No newline at end of file |