diff options
author | gareth | 2007-03-04 01:57:52 +0000 |
---|---|---|
committer | gareth | 2007-03-04 01:57:52 +0000 |
commit | 412d7e098c424745c0c2ae1a6526c5b5d58b3180 (patch) | |
tree | adf1e02de27534503dcb3f7b4619d89366c2b8a5 /src | |
parent | Keeping the MSVC project file up to date (diff) | |
download | opensim-SC_OLD-412d7e098c424745c0c2ae1a6526c5b5d58b3180.zip opensim-SC_OLD-412d7e098c424745c0c2ae1a6526c5b5d58b3180.tar.gz opensim-SC_OLD-412d7e098c424745c0c2ae1a6526c5b5d58b3180.tar.bz2 opensim-SC_OLD-412d7e098c424745c0c2ae1a6526c5b5d58b3180.tar.xz |
Fixed up bugs from patch in PREV:
Slow movement of avatar FIXED
Constant TerseObjectUpdates FIXED
Moving out of sim FIXED
Diffstat (limited to 'src')
-rw-r--r-- | src/world/Avatar.cs | 15 | ||||
-rw-r--r-- | src/world/PhysicsEngine.cs | 11 | ||||
-rw-r--r-- | src/world/World.cs | 25 |
3 files changed, 30 insertions, 21 deletions
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index 68606c4..fbd78b7 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs | |||
@@ -13,7 +13,10 @@ namespace OpenSim.world | |||
13 | public string firstname; | 13 | public string firstname; |
14 | public string lastname; | 14 | public string lastname; |
15 | public OpenSimClient ControllingClient; | 15 | public OpenSimClient ControllingClient; |
16 | public LLVector3 oldvel; | ||
17 | public LLVector3 oldpos; | ||
16 | public uint CurrentKeyMask; | 18 | public uint CurrentKeyMask; |
19 | public bool walking; | ||
17 | 20 | ||
18 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | 21 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; |
19 | 22 | ||
@@ -30,18 +33,22 @@ namespace OpenSim.world | |||
30 | base.update(); | 33 | base.update(); |
31 | 34 | ||
32 | Console.WriteLine("KeyMask: " + this.CurrentKeyMask); | 35 | Console.WriteLine("KeyMask: " + this.CurrentKeyMask); |
33 | 36 | ||
37 | oldvel=this.velocity; | ||
38 | oldpos=this.position; | ||
34 | if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) { | 39 | if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) { |
35 | Vector3 tmpVelocity = this.rotation * new Vector3(1.0f,0.0f,0.0f); | 40 | Vector3 tmpVelocity = this.rotation * new Vector3(1.0f,0.0f,0.0f); |
36 | tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.3f; | 41 | tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.5f; |
37 | this.velocity.X = tmpVelocity.x; | 42 | this.velocity.X = tmpVelocity.x; |
38 | this.velocity.Y = tmpVelocity.y; | 43 | this.velocity.Y = tmpVelocity.y; |
39 | this.velocity.Z = tmpVelocity.z; | 44 | this.velocity.Z = tmpVelocity.z; |
40 | Console.WriteLine("Walking at "+ this.velocity.ToString()); | 45 | Console.WriteLine("Walking at "+ this.velocity.ToString()); |
46 | this.walking=true; | ||
41 | } else { | 47 | } else { |
42 | this.velocity.X=0; | 48 | this.velocity.X=0; |
43 | this.velocity.Y=0; | 49 | this.velocity.Y=0; |
44 | this.velocity.Z=0; | 50 | this.velocity.Z=0; |
51 | this.walking=false; | ||
45 | } | 52 | } |
46 | } | 53 | } |
47 | } | 54 | } |
@@ -238,10 +245,8 @@ namespace OpenSim.world | |||
238 | 245 | ||
239 | public void HandleAgentUpdate(AgentUpdatePacket update) { | 246 | public void HandleAgentUpdate(AgentUpdatePacket update) { |
240 | lock(this) { | 247 | lock(this) { |
241 | // FIXME: shouldn't update these direction | ||
242 | this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z); | ||
243 | |||
244 | this.CurrentKeyMask = update.AgentData.ControlFlags; | 248 | this.CurrentKeyMask = update.AgentData.ControlFlags; |
249 | this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z); | ||
245 | this.needupdate = true; | 250 | this.needupdate = true; |
246 | } | 251 | } |
247 | } | 252 | } |
diff --git a/src/world/PhysicsEngine.cs b/src/world/PhysicsEngine.cs index a789828..d9351af 100644 --- a/src/world/PhysicsEngine.cs +++ b/src/world/PhysicsEngine.cs | |||
@@ -20,11 +20,12 @@ namespace OpenSim.world | |||
20 | public void DoStuff(World simworld) { | 20 | public void DoStuff(World simworld) { |
21 | foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys) | 21 | foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys) |
22 | { | 22 | { |
23 | if( true /* simworld.Entities[UUID].needupdate */) { // FIXME! | 23 | if((simworld.Entities[UUID].position.X>0) & (simworld.Entities[UUID].position.X<256) & (simworld.Entities[UUID].position.Y>1) & (simworld.Entities[UUID].position.Y<256)) { |
24 | simworld.Entities[UUID].position += simworld.Entities[UUID].velocity; | 24 | simworld.Entities[UUID].position += simworld.Entities[UUID].velocity; |
25 | Console.WriteLine("Moving "+UUID.ToString()+ " to "+ simworld.Entities[UUID].position.ToString()); | 25 | simworld.Entities[UUID].position.Z = simworld.LandMap[(int)simworld.Entities[UUID].position.Y * 256 + (int)simworld.Entities[UUID].position.X]+1; |
26 | } | 26 | } else { |
27 | 27 | simworld.Entities[UUID].velocity = new LLVector3(0f,0f,0f); | |
28 | } | ||
28 | } | 29 | } |
29 | } | 30 | } |
30 | } | 31 | } |
diff --git a/src/world/World.cs b/src/world/World.cs index b261884..f32f9ef 100644 --- a/src/world/World.cs +++ b/src/world/World.cs | |||
@@ -50,17 +50,20 @@ namespace OpenSim.world | |||
50 | { | 50 | { |
51 | if(Entities[UUID].needupdate) { | 51 | if(Entities[UUID].needupdate) { |
52 | Entities[UUID].update(); | 52 | Entities[UUID].update(); |
53 | } | 53 | |
54 | if(Entities[UUID] is Avatar) { // FIXME: only send updates when avatar moves. | 54 | if(Entities[UUID] is Avatar) { |
55 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock(); | 55 | Avatar avatar=(Avatar)Entities[UUID]; |
56 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | 56 | if((avatar.oldpos!=avatar.position) || (avatar.oldvel!=avatar.velocity) || avatar.walking) { |
57 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 57 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock(); |
58 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | 58 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { |
59 | terse.RegionData.TimeDilation = 0; | 59 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
60 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 60 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME |
61 | terse.ObjectData[0] = terseBlock; | 61 | terse.RegionData.TimeDilation = 0; |
62 | client.OutPacket(terse); | 62 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
63 | } | 63 | terse.ObjectData[0] = terseBlock; |
64 | client.OutPacket(terse); | ||
65 | } | ||
66 | }} | ||
64 | } | 67 | } |
65 | } | 68 | } |
66 | } | 69 | } |