diff options
author | UbitUmarov | 2014-07-23 20:31:54 +0100 |
---|---|---|
committer | UbitUmarov | 2014-07-23 20:31:54 +0100 |
commit | 237075ce21ddde71e8bba475fc4f37525cfcf098 (patch) | |
tree | ca33a351b238a38a99beb5775b598fa4220dcc3d /OpenSim/Region/Framework/Scenes | |
parent | changed locations of m_originRegionID setting to where current core has (diff) | |
download | opensim-SC_OLD-237075ce21ddde71e8bba475fc4f37525cfcf098.zip opensim-SC_OLD-237075ce21ddde71e8bba475fc4f37525cfcf098.tar.gz opensim-SC_OLD-237075ce21ddde71e8bba475fc4f37525cfcf098.tar.bz2 opensim-SC_OLD-237075ce21ddde71e8bba475fc4f37525cfcf098.tar.xz |
cleanup a bit presence CheckForBorderCrossing removing dead code
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 239 |
1 files changed, 113 insertions, 126 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 258ca20..8e6e8fd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3475,7 +3475,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3475 | protected void CheckForBorderCrossing() | 3475 | protected void CheckForBorderCrossing() |
3476 | { | 3476 | { |
3477 | // Check that we we are not a child | 3477 | // Check that we we are not a child |
3478 | if (IsChildAgent) | 3478 | if (IsChildAgent) |
3479 | return; | 3479 | return; |
3480 | 3480 | ||
3481 | // If we don't have a PhysActor, we can't cross anyway | 3481 | // If we don't have a PhysActor, we can't cross anyway |
@@ -3485,140 +3485,127 @@ namespace OpenSim.Region.Framework.Scenes | |||
3485 | if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) | 3485 | if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) |
3486 | return; | 3486 | return; |
3487 | 3487 | ||
3488 | if (!IsInTransit) | 3488 | if (IsInTransit) |
3489 | { | 3489 | return; |
3490 | Vector3 pos2 = AbsolutePosition; | ||
3491 | Vector3 vel = Velocity; | ||
3492 | int neighbor = 0; | ||
3493 | int[] fix = new int[2]; | ||
3494 | 3490 | ||
3495 | float timeStep = 0.1f; | 3491 | Vector3 pos2 = AbsolutePosition; |
3496 | pos2.X = pos2.X + (vel.X * timeStep); | 3492 | Vector3 vel = Velocity; |
3497 | pos2.Y = pos2.Y + (vel.Y * timeStep); | 3493 | int neighbor = 0; |
3498 | pos2.Z = pos2.Z + (vel.Z * timeStep); | 3494 | int[] fix = new int[2]; |
3499 | 3495 | ||
3500 | if (!IsInTransit) | 3496 | float timeStep = 0.1f; |
3501 | { | 3497 | pos2.X = pos2.X + (vel.X * timeStep); |
3502 | // m_log.DebugFormat( | 3498 | pos2.Y = pos2.Y + (vel.Y * timeStep); |
3503 | // "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", | 3499 | pos2.Z = pos2.Z + (vel.Z * timeStep); |
3504 | // pos2, Name, Scene.Name); | ||
3505 | 3500 | ||
3506 | // Checks if where it's headed exists a region | ||
3507 | bool needsTransit = false; | ||
3508 | if (m_scene.TestBorderCross(pos2, Cardinals.W)) | ||
3509 | { | ||
3510 | if (m_scene.TestBorderCross(pos2, Cardinals.S)) | ||
3511 | { | ||
3512 | needsTransit = true; | ||
3513 | neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix); | ||
3514 | } | ||
3515 | else if (m_scene.TestBorderCross(pos2, Cardinals.N)) | ||
3516 | { | ||
3517 | needsTransit = true; | ||
3518 | neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix); | ||
3519 | } | ||
3520 | else | ||
3521 | { | ||
3522 | needsTransit = true; | ||
3523 | neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix); | ||
3524 | } | ||
3525 | } | ||
3526 | else if (m_scene.TestBorderCross(pos2, Cardinals.E)) | ||
3527 | { | ||
3528 | if (m_scene.TestBorderCross(pos2, Cardinals.S)) | ||
3529 | { | ||
3530 | needsTransit = true; | ||
3531 | neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix); | ||
3532 | } | ||
3533 | else if (m_scene.TestBorderCross(pos2, Cardinals.N)) | ||
3534 | { | ||
3535 | needsTransit = true; | ||
3536 | neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix); | ||
3537 | } | ||
3538 | else | ||
3539 | { | ||
3540 | needsTransit = true; | ||
3541 | neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix); | ||
3542 | } | ||
3543 | } | ||
3544 | else if (m_scene.TestBorderCross(pos2, Cardinals.S)) | ||
3545 | { | ||
3546 | needsTransit = true; | ||
3547 | neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix); | ||
3548 | } | ||
3549 | else if (m_scene.TestBorderCross(pos2, Cardinals.N)) | ||
3550 | { | ||
3551 | needsTransit = true; | ||
3552 | neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix); | ||
3553 | } | ||
3554 | 3501 | ||
3555 | // Makes sure avatar does not end up outside region | 3502 | // m_log.DebugFormat( |
3556 | if (neighbor <= 0) | 3503 | // "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", |
3557 | { | 3504 | // pos2, Name, Scene.Name); |
3558 | if (needsTransit) | 3505 | |
3559 | { | 3506 | // Checks if where it's headed exists a region |
3560 | if (m_requestedSitTargetUUID == UUID.Zero) | 3507 | bool needsTransit = false; |
3561 | { | 3508 | if (m_scene.TestBorderCross(pos2, Cardinals.W)) |
3562 | bool isFlying = Flying; | 3509 | { |
3563 | RemoveFromPhysicalScene(); | 3510 | if (m_scene.TestBorderCross(pos2, Cardinals.S)) |
3564 | 3511 | { | |
3565 | Vector3 pos = AbsolutePosition; | 3512 | needsTransit = true; |
3566 | if (AbsolutePosition.X < 0) | 3513 | neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix); |
3567 | pos.X += Velocity.X * 2; | 3514 | } |
3568 | else if (AbsolutePosition.X > Constants.RegionSize) | 3515 | else if (m_scene.TestBorderCross(pos2, Cardinals.N)) |
3569 | pos.X -= Velocity.X * 2; | 3516 | { |
3570 | if (AbsolutePosition.Y < 0) | 3517 | needsTransit = true; |
3571 | pos.Y += Velocity.Y * 2; | 3518 | neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix); |
3572 | else if (AbsolutePosition.Y > Constants.RegionSize) | 3519 | } |
3573 | pos.Y -= Velocity.Y * 2; | 3520 | else |
3574 | Velocity = Vector3.Zero; | 3521 | { |
3575 | AbsolutePosition = pos; | 3522 | needsTransit = true; |
3576 | 3523 | neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix); | |
3577 | // m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition); | 3524 | } |
3578 | 3525 | } | |
3579 | AddToPhysicalScene(isFlying); | 3526 | else if (m_scene.TestBorderCross(pos2, Cardinals.E)) |
3580 | } | 3527 | { |
3581 | } | 3528 | if (m_scene.TestBorderCross(pos2, Cardinals.S)) |
3582 | } | 3529 | { |
3583 | else if (neighbor > 0) | 3530 | needsTransit = true; |
3531 | neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix); | ||
3532 | } | ||
3533 | else if (m_scene.TestBorderCross(pos2, Cardinals.N)) | ||
3534 | { | ||
3535 | needsTransit = true; | ||
3536 | neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix); | ||
3537 | } | ||
3538 | else | ||
3539 | { | ||
3540 | needsTransit = true; | ||
3541 | neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix); | ||
3542 | } | ||
3543 | } | ||
3544 | else if (m_scene.TestBorderCross(pos2, Cardinals.S)) | ||
3545 | { | ||
3546 | needsTransit = true; | ||
3547 | neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix); | ||
3548 | } | ||
3549 | else if (m_scene.TestBorderCross(pos2, Cardinals.N)) | ||
3550 | { | ||
3551 | needsTransit = true; | ||
3552 | neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix); | ||
3553 | } | ||
3554 | |||
3555 | // Makes sure avatar does not end up outside region | ||
3556 | if (neighbor <= 0) | ||
3557 | { | ||
3558 | if (needsTransit) | ||
3559 | { | ||
3560 | if (m_requestedSitTargetUUID == UUID.Zero) | ||
3584 | { | 3561 | { |
3585 | if (!CrossToNewRegion()) | 3562 | bool isFlying = Flying; |
3586 | { | 3563 | RemoveFromPhysicalScene(); |
3587 | if (m_requestedSitTargetUUID == UUID.Zero) | 3564 | |
3588 | { | 3565 | Vector3 pos = AbsolutePosition; |
3589 | bool isFlying = Flying; | 3566 | if (AbsolutePosition.X < 0) |
3590 | RemoveFromPhysicalScene(); | 3567 | pos.X += Velocity.X * 2; |
3591 | 3568 | else if (AbsolutePosition.X > Constants.RegionSize) | |
3592 | Vector3 pos = AbsolutePosition; | 3569 | pos.X -= Velocity.X * 2; |
3593 | if (AbsolutePosition.X < 0) | 3570 | if (AbsolutePosition.Y < 0) |
3594 | pos.X += Velocity.X * 2; | 3571 | pos.Y += Velocity.Y * 2; |
3595 | else if (AbsolutePosition.X > Constants.RegionSize) | 3572 | else if (AbsolutePosition.Y > Constants.RegionSize) |
3596 | pos.X -= Velocity.X * 2; | 3573 | pos.Y -= Velocity.Y * 2; |
3597 | if (AbsolutePosition.Y < 0) | 3574 | Velocity = Vector3.Zero; |
3598 | pos.Y += Velocity.Y * 2; | 3575 | AbsolutePosition = pos; |
3599 | else if (AbsolutePosition.Y > Constants.RegionSize) | 3576 | |
3600 | pos.Y -= Velocity.Y * 2; | 3577 | // m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition); |
3601 | Velocity = Vector3.Zero; | 3578 | |
3602 | AbsolutePosition = pos; | 3579 | AddToPhysicalScene(isFlying); |
3603 | |||
3604 | AddToPhysicalScene(isFlying); | ||
3605 | } | ||
3606 | } | ||
3607 | } | 3580 | } |
3608 | } | 3581 | } |
3609 | else | 3582 | } |
3583 | else if (neighbor > 0) | ||
3584 | { | ||
3585 | if (!CrossToNewRegion()) | ||
3610 | { | 3586 | { |
3611 | // This constant has been inferred from experimentation | 3587 | if (m_requestedSitTargetUUID == UUID.Zero) |
3612 | // I'm not sure what this value should be, so I tried a few values. | 3588 | { |
3613 | timeStep = 0.04f; | 3589 | bool isFlying = Flying; |
3614 | pos2 = AbsolutePosition; | 3590 | RemoveFromPhysicalScene(); |
3615 | pos2.X = pos2.X + (vel.X * timeStep); | 3591 | |
3616 | pos2.Y = pos2.Y + (vel.Y * timeStep); | 3592 | Vector3 pos = AbsolutePosition; |
3617 | // Don't touch the Z | 3593 | if (AbsolutePosition.X < 0) |
3618 | m_pos = pos2; | 3594 | pos.X += Velocity.X * 2; |
3619 | m_log.DebugFormat("[SCENE PRESENCE]: In transit m_pos={0}", m_pos); | 3595 | else if (AbsolutePosition.X > Constants.RegionSize) |
3596 | pos.X -= Velocity.X * 2; | ||
3597 | if (AbsolutePosition.Y < 0) | ||
3598 | pos.Y += Velocity.Y * 2; | ||
3599 | else if (AbsolutePosition.Y > Constants.RegionSize) | ||
3600 | pos.Y -= Velocity.Y * 2; | ||
3601 | Velocity = Vector3.Zero; | ||
3602 | AbsolutePosition = pos; | ||
3603 | |||
3604 | AddToPhysicalScene(isFlying); | ||
3605 | } | ||
3620 | } | 3606 | } |
3621 | } | 3607 | } |
3608 | |||
3622 | } | 3609 | } |
3623 | 3610 | ||
3624 | /// <summary> | 3611 | /// <summary> |