aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs92
1 files changed, 82 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9c7559b..4973663 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -164,6 +164,8 @@ namespace OpenSim.Region.Framework.Scenes
164 164
165 private Quaternion m_bodyRot= Quaternion.Identity; 165 private Quaternion m_bodyRot= Quaternion.Identity;
166 166
167 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
168
167 private const int LAND_VELOCITYMAG_MAX = 12; 169 private const int LAND_VELOCITYMAG_MAX = 12;
168 170
169 public bool IsRestrictedToRegion; 171 public bool IsRestrictedToRegion;
@@ -225,7 +227,7 @@ namespace OpenSim.Region.Framework.Scenes
225 // Agent's Draw distance. 227 // Agent's Draw distance.
226 protected float m_DrawDistance; 228 protected float m_DrawDistance;
227 229
228 protected AvatarAppearance m_appearance; 230 protected AvatarAppearance m_appearance;
229 231
230 // neighbouring regions we have enabled a child agent in 232 // neighbouring regions we have enabled a child agent in
231 // holds the seed cap for the child agent in that region 233 // holds the seed cap for the child agent in that region
@@ -508,6 +510,12 @@ namespace OpenSim.Region.Framework.Scenes
508 set { m_bodyRot = value; } 510 set { m_bodyRot = value; }
509 } 511 }
510 512
513 public Quaternion PreviousRotation
514 {
515 get { return m_bodyRotPrevious; }
516 set { m_bodyRotPrevious = value; }
517 }
518
511 /// <summary> 519 /// <summary>
512 /// If this is true, agent doesn't have a representation in this scene. 520 /// If this is true, agent doesn't have a representation in this scene.
513 /// this is an agent 'looking into' this scene from a nearby scene(region) 521 /// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -640,7 +648,7 @@ namespace OpenSim.Region.Framework.Scenes
640 #region Constructor(s) 648 #region Constructor(s)
641 649
642 public ScenePresence() 650 public ScenePresence()
643 { 651 {
644 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 652 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
645 CreateSceneViewer(); 653 CreateSceneViewer();
646 m_animator = new ScenePresenceAnimator(this); 654 m_animator = new ScenePresenceAnimator(this);
@@ -824,6 +832,31 @@ namespace OpenSim.Region.Framework.Scenes
824 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) 832 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
825 { 833 {
826 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 834 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
835
836 if (pos.X < 0)
837 {
838 emergencyPos.X = (int)Constants.RegionSize + pos.X;
839 if (!(pos.Y < 0))
840 emergencyPos.Y = pos.Y;
841 if (!(pos.Z < 0))
842 emergencyPos.X = pos.X;
843 }
844 if (pos.Y < 0)
845 {
846 emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
847 if (!(pos.X < 0))
848 emergencyPos.X = pos.X;
849 if (!(pos.Z < 0))
850 emergencyPos.Z = pos.Z;
851 }
852 if (pos.Z < 0)
853 {
854 if (!(pos.X < 0))
855 emergencyPos.X = pos.X;
856 if (!(pos.Y < 0))
857 emergencyPos.Y = pos.Y;
858 //Leave as 128
859 }
827 860
828 m_log.WarnFormat( 861 m_log.WarnFormat(
829 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 862 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
@@ -2704,36 +2737,75 @@ namespace OpenSim.Region.Framework.Scenes
2704 { 2737 {
2705 // Checks if where it's headed exists a region 2738 // Checks if where it's headed exists a region
2706 2739
2740 bool needsTransit = false;
2707 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 2741 if (m_scene.TestBorderCross(pos2, Cardinals.W))
2708 { 2742 {
2709 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2743 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2744 {
2745 needsTransit = true;
2710 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 2746 neighbor = HaveNeighbor(Cardinals.SW, ref fix);
2747 }
2711 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2748 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2749 {
2750 needsTransit = true;
2712 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 2751 neighbor = HaveNeighbor(Cardinals.NW, ref fix);
2752 }
2713 else 2753 else
2754 {
2755 needsTransit = true;
2714 neighbor = HaveNeighbor(Cardinals.W, ref fix); 2756 neighbor = HaveNeighbor(Cardinals.W, ref fix);
2757 }
2715 } 2758 }
2716 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 2759 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2717 { 2760 {
2718 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2761 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2762 {
2763 needsTransit = true;
2719 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 2764 neighbor = HaveNeighbor(Cardinals.SE, ref fix);
2765 }
2720 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2766 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2767 {
2768 needsTransit = true;
2721 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 2769 neighbor = HaveNeighbor(Cardinals.NE, ref fix);
2770 }
2722 else 2771 else
2772 {
2773 needsTransit = true;
2723 neighbor = HaveNeighbor(Cardinals.E, ref fix); 2774 neighbor = HaveNeighbor(Cardinals.E, ref fix);
2775 }
2724 } 2776 }
2725 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2777 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2778 {
2779 needsTransit = true;
2726 neighbor = HaveNeighbor(Cardinals.S, ref fix); 2780 neighbor = HaveNeighbor(Cardinals.S, ref fix);
2781 }
2727 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2782 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2783 {
2784 needsTransit = true;
2728 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2785 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2786 }
2787
2729 2788
2730
2731 // Makes sure avatar does not end up outside region 2789 // Makes sure avatar does not end up outside region
2732 if (neighbor < 0) 2790 if (neighbor <= 0)
2733 AbsolutePosition = new Vector3( 2791 {
2734 AbsolutePosition.X + 3*fix[0], 2792 if (!needsTransit)
2735 AbsolutePosition.Y + 3*fix[1], 2793 {
2736 AbsolutePosition.Z); 2794 if (m_requestedSitTargetUUID == UUID.Zero)
2795 {
2796 Vector3 pos = AbsolutePosition;
2797 if (AbsolutePosition.X < 0)
2798 pos.X += Velocity.X;
2799 else if (AbsolutePosition.X > Constants.RegionSize)
2800 pos.X -= Velocity.X;
2801 if (AbsolutePosition.Y < 0)
2802 pos.Y += Velocity.Y;
2803 else if (AbsolutePosition.Y > Constants.RegionSize)
2804 pos.Y -= Velocity.Y;
2805 AbsolutePosition = pos;
2806 }
2807 }
2808 }
2737 else if (neighbor > 0) 2809 else if (neighbor > 0)
2738 CrossToNewRegion(); 2810 CrossToNewRegion();
2739 } 2811 }
@@ -3193,7 +3265,7 @@ namespace OpenSim.Region.Framework.Scenes
3193 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3265 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3194 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3266 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3195 m_physicsActor.SubscribeEvents(500); 3267 m_physicsActor.SubscribeEvents(500);
3196 m_physicsActor.LocalID = LocalId; 3268 m_physicsActor.LocalID = LocalId;
3197 } 3269 }
3198 3270
3199 private void OutOfBoundsCall(Vector3 pos) 3271 private void OutOfBoundsCall(Vector3 pos)
@@ -3285,7 +3357,7 @@ namespace OpenSim.Region.Framework.Scenes
3285 } 3357 }
3286 if (m_health <= 0) 3358 if (m_health <= 0)
3287 m_scene.EventManager.TriggerAvatarKill(killerObj, this); 3359 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
3288 } 3360 }
3289 } 3361 }
3290 3362
3291 public void setHealthWithUpdate(float health) 3363 public void setHealthWithUpdate(float health)