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 lastname;
public OpenSimClient ControllingClient;
public LLVector3 oldvel;
public LLVector3 oldpos;
public uint CurrentKeyMask;
public bool walking;
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
@ -31,17 +34,21 @@ namespace OpenSim.world
Console.WriteLine("KeyMask: " + this.CurrentKeyMask);
oldvel=this.velocity;
oldpos=this.position;
if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) {
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.Y = tmpVelocity.y;
this.velocity.Z = tmpVelocity.z;
Console.WriteLine("Walking at "+ this.velocity.ToString());
this.walking=true;
} else {
this.velocity.X=0;
this.velocity.Y=0;
this.velocity.Z=0;
this.walking=false;
}
}
}
@ -238,10 +245,8 @@ namespace OpenSim.world
public void HandleAgentUpdate(AgentUpdatePacket update) {
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.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z);
this.needupdate = true;
}
}

View File

@ -20,11 +20,12 @@ namespace OpenSim.world
public void DoStuff(World simworld) {
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;
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,8 +50,10 @@ namespace OpenSim.world
{
if(Entities[UUID].needupdate) {
Entities[UUID].update();
}
if(Entities[UUID] is Avatar) { // FIXME: only send updates when avatar moves.
if(Entities[UUID] is Avatar) {
Avatar avatar=(Avatar)Entities[UUID];
if((avatar.oldpos!=avatar.position) || (avatar.oldvel!=avatar.velocity) || avatar.walking) {
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock();
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
@ -61,6 +63,7 @@ namespace OpenSim.world
terse.ObjectData[0] = terseBlock;
client.OutPacket(terse);
}
}}
}
}
}