aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
diff options
context:
space:
mode:
authorMW2007-06-15 16:03:02 +0000
committerMW2007-06-15 16:03:02 +0000
commit17b4818b8e9a141b54540b342542bcb2ad21b4db (patch)
tree5abca9ede1e82d4a2e01301cc19eed25ad88702a /OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
parentPreliminary movement added to sugilite, forwards walking only and no animations. (diff)
downloadopensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.zip
opensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.tar.gz
opensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.tar.bz2
opensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.tar.xz
Very Preliminary border crossing added to sugilite. (Note: Sugilite doesn't have any backend ogs communication support yet so everything is Sandbox mode only )
Diffstat (limited to 'OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs62
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;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Physics.Manager; 33using OpenSim.Physics.Manager;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types;
35 36
36namespace OpenSim.Region.Scenes 37namespace 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}