diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs index 3f87e10..d46bf0f 100644 --- a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs +++ b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs | |||
@@ -32,6 +32,7 @@ using libsecondlife; | |||
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Physics.Manager; | 33 | using OpenSim.Physics.Manager; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Types; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Scenes | 37 | namespace OpenSim.Region.Scenes |
37 | { | 38 | { |
@@ -55,7 +56,24 @@ namespace OpenSim.Region.Scenes | |||
55 | this.SendTerseUpdateToALLClients(); | 56 | this.SendTerseUpdateToALLClients(); |
56 | _updateCount = 0; | 57 | _updateCount = 0; |
57 | } | 58 | } |
58 | } | 59 | } |
60 | |||
61 | LLVector3 pos2 = this.Pos; | ||
62 | LLVector3 vel = this.Velocity; | ||
63 | |||
64 | float timeStep = 0.3f; | ||
65 | pos2.X = pos2.X + (vel.X * timeStep); | ||
66 | pos2.Y = pos2.Y + (vel.Y * timeStep); | ||
67 | pos2.Z = pos2.Z + (vel.Z * timeStep); | ||
68 | if ((pos2.X < 0) || (pos2.X > 256)) | ||
69 | { | ||
70 | this.CrossToNewRegion(); | ||
71 | } | ||
72 | |||
73 | if ((pos2.Y < 0) || (pos2.Y > 256)) | ||
74 | { | ||
75 | this.CrossToNewRegion(); | ||
76 | } | ||
59 | } | 77 | } |
60 | 78 | ||
61 | /// <summary> | 79 | /// <summary> |
@@ -147,5 +165,47 @@ namespace OpenSim.Region.Scenes | |||
147 | 165 | ||
148 | } | 166 | } |
149 | 167 | ||
168 | private void CrossToNewRegion() | ||
169 | { | ||
170 | |||
171 | // Console.WriteLine("crossing to new region from region " + this.m_regionInfo.RegionLocX + " , "+ this.m_regionInfo.RegionLocY); | ||
172 | LLVector3 pos = this.Pos; | ||
173 | LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
174 | uint neighbourx = this.m_regionInfo.RegionLocX; | ||
175 | uint neighboury = this.m_regionInfo.RegionLocY; | ||
176 | |||
177 | if (pos.X < 2) | ||
178 | { | ||
179 | neighbourx -= 1; | ||
180 | newpos.X = 254; | ||
181 | } | ||
182 | if (pos.X > 253) | ||
183 | { | ||
184 | neighbourx += 1; | ||
185 | newpos.X = 1; | ||
186 | } | ||
187 | if (pos.Y < 2) | ||
188 | { | ||
189 | neighboury -= 1; | ||
190 | newpos.Y = 254; | ||
191 | } | ||
192 | if (pos.Y > 253) | ||
193 | { | ||
194 | neighboury += 1; | ||
195 | newpos.Y = 1; | ||
196 | } | ||
197 | |||
198 | LLVector3 vel = this.velocity; | ||
199 | // Console.WriteLine("new region should be " + neighbourx + " , " + neighboury); | ||
200 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256)); | ||
201 | RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); | ||
202 | if (neighbourRegion != null) | ||
203 | { | ||
204 | // Console.WriteLine("current region port is "+ this.m_regionInfo.IPListenPort + " now crossing to new region with port " + neighbourRegion.IPListenPort); | ||
205 | this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); | ||
206 | this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort); | ||
207 | } | ||
208 | } | ||
209 | |||
150 | } | 210 | } |
151 | } | 211 | } |