Fixed up bugs from patch in PREV:

Slow movement of avatar FIXED
Constant TerseObjectUpdates FIXED
Moving out of sim FIXED
adam
gareth 2007-03-04 01:57:52 +00:00
parent c3daab6434
commit 412d7e098c
3 changed files with 30 additions and 21 deletions

View File

@ -13,7 +13,10 @@ namespace OpenSim.world
public string firstname; public string firstname;
public string lastname; public string lastname;
public OpenSimClient ControllingClient; public OpenSimClient ControllingClient;
public LLVector3 oldvel;
public LLVector3 oldpos;
public uint CurrentKeyMask; public uint CurrentKeyMask;
public bool walking;
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
@ -30,18 +33,22 @@ namespace OpenSim.world
base.update(); base.update();
Console.WriteLine("KeyMask: " + this.CurrentKeyMask); Console.WriteLine("KeyMask: " + this.CurrentKeyMask);
oldvel=this.velocity;
oldpos=this.position;
if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) { if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) {
Vector3 tmpVelocity = this.rotation * new Vector3(1.0f,0.0f,0.0f); Vector3 tmpVelocity = this.rotation * new Vector3(1.0f,0.0f,0.0f);
tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.3f; tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.5f;
this.velocity.X = tmpVelocity.x; this.velocity.X = tmpVelocity.x;
this.velocity.Y = tmpVelocity.y; this.velocity.Y = tmpVelocity.y;
this.velocity.Z = tmpVelocity.z; this.velocity.Z = tmpVelocity.z;
Console.WriteLine("Walking at "+ this.velocity.ToString()); Console.WriteLine("Walking at "+ this.velocity.ToString());
this.walking=true;
} else { } else {
this.velocity.X=0; this.velocity.X=0;
this.velocity.Y=0; this.velocity.Y=0;
this.velocity.Z=0; this.velocity.Z=0;
this.walking=false;
} }
} }
} }
@ -238,10 +245,8 @@ namespace OpenSim.world
public void HandleAgentUpdate(AgentUpdatePacket update) { public void HandleAgentUpdate(AgentUpdatePacket update) {
lock(this) { lock(this) {
// FIXME: shouldn't update these direction
this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z);
this.CurrentKeyMask = update.AgentData.ControlFlags; this.CurrentKeyMask = update.AgentData.ControlFlags;
this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z);
this.needupdate = true; this.needupdate = true;
} }
} }

View File

@ -20,11 +20,12 @@ namespace OpenSim.world
public void DoStuff(World simworld) { public void DoStuff(World simworld) {
foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys) foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys)
{ {
if( true /* simworld.Entities[UUID].needupdate */) { // FIXME! 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)) {
simworld.Entities[UUID].position += simworld.Entities[UUID].velocity; simworld.Entities[UUID].position += simworld.Entities[UUID].velocity;
Console.WriteLine("Moving "+UUID.ToString()+ " to "+ simworld.Entities[UUID].position.ToString()); simworld.Entities[UUID].position.Z = simworld.LandMap[(int)simworld.Entities[UUID].position.Y * 256 + (int)simworld.Entities[UUID].position.X]+1;
} } else {
simworld.Entities[UUID].velocity = new LLVector3(0f,0f,0f);
}
} }
} }
} }

View File

@ -50,17 +50,20 @@ namespace OpenSim.world
{ {
if(Entities[UUID].needupdate) { if(Entities[UUID].needupdate) {
Entities[UUID].update(); Entities[UUID].update();
}
if(Entities[UUID] is Avatar) { // FIXME: only send updates when avatar moves. if(Entities[UUID] is Avatar) {
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock(); Avatar avatar=(Avatar)Entities[UUID];
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { if((avatar.oldpos!=avatar.position) || (avatar.oldvel!=avatar.velocity) || avatar.walking) {
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock();
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
terse.RegionData.TimeDilation = 0; ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
terse.ObjectData[0] = terseBlock; terse.RegionData.TimeDilation = 0;
client.OutPacket(terse); terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
} terse.ObjectData[0] = terseBlock;
client.OutPacket(terse);
}
}}
} }
} }
} }