Fixed up bugs from patch in PREV:
Slow movement of avatar FIXED Constant TerseObjectUpdates FIXED Moving out of sim FIXEDadam
parent
c3daab6434
commit
412d7e098c
|
@ -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;
|
||||
|
||||
|
@ -30,18 +33,22 @@ namespace OpenSim.world
|
|||
base.update();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!
|
||||
simworld.Entities[UUID].position += simworld.Entities[UUID].velocity;
|
||||
Console.WriteLine("Moving "+UUID.ToString()+ " to "+ simworld.Entities[UUID].position.ToString());
|
||||
}
|
||||
|
||||
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.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,17 +50,20 @@ namespace OpenSim.world
|
|||
{
|
||||
if(Entities[UUID].needupdate) {
|
||||
Entities[UUID].update();
|
||||
}
|
||||
if(Entities[UUID] is Avatar) { // FIXME: only send updates when avatar moves.
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock();
|
||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 0;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = terseBlock;
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
|
||||
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();
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 0;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = terseBlock;
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue