Begun porting a (STABLE) version of MW's movement code

adam
gareth 2007-03-03 01:49:56 +00:00
parent 442036fa8e
commit b968ff83a9
3 changed files with 30 additions and 5 deletions

View File

@ -12,6 +12,8 @@ namespace OpenSim.world
public string firstname; public string firstname;
public string lastname; public string lastname;
public OpenSimClient ControllingClient; public OpenSimClient ControllingClient;
public uint CurrentKeyMask;
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
public Avatar(OpenSimClient TheClient) { public Avatar(OpenSimClient TheClient) {
@ -21,7 +23,21 @@ namespace OpenSim.world
} }
public void update() { public void update() {
base.update(); lock(this) {
base.update();
if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) {
if((this.velocity.X>230) & (this.velocity.Y>230)) {
this.velocity.X=230;
this.velocity.Y=230;
this.velocity.Z=0;
}
} else {
this.velocity.X=0;
this.velocity.Y=0;
this.velocity.Z=0;
}
}
} }
private void SetupTemplate(string name) private void SetupTemplate(string name)

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Axiom.MathLib; using Axiom.MathLib;
using libsecondlife;
using OpenSim.types; using OpenSim.types;
namespace OpenSim.world namespace OpenSim.world
@ -9,8 +10,8 @@ namespace OpenSim.world
public class Entity public class Entity
{ {
protected libsecondlife.LLUUID uuid; protected libsecondlife.LLUUID uuid;
protected Vector3 position; public LLVector3 position;
protected Vector3 velocity; public LLVector3 velocity;
protected Quaternion rotation; protected Quaternion rotation;
protected string name; protected string name;
protected List<Entity> children; protected List<Entity> children;
@ -19,8 +20,8 @@ namespace OpenSim.world
public Entity() public Entity()
{ {
uuid = new libsecondlife.LLUUID(); uuid = new libsecondlife.LLUUID();
position = new Vector3(); position = new LLVector3();
velocity = new Vector3(); velocity = new LLVector3();
rotation = new Quaternion(); rotation = new Quaternion();
name = "(basic entity)"; name = "(basic entity)";
children = new List<Entity>(); children = new List<Entity>();
@ -33,6 +34,7 @@ namespace OpenSim.world
if(child.needupdate) if(child.needupdate)
child.update(); child.update();
} }
this.needupdate=false;
} }
public virtual string getName() public virtual string getName()

View File

@ -18,6 +18,13 @@ namespace OpenSim.world
} }
public void DoStuff(World simworld) { public void DoStuff(World simworld) {
foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys)
{
if(simworld.Entities[UUID].needupdate) {
simworld.Entities[UUID].position += simworld.Entities[UUID].velocity;
}
}
} }
} }
} }