r105 somehow got put in wrong place, so replacing files
parent
40a52b0f55
commit
acc98fca7b
|
@ -4,231 +4,148 @@ using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
using PhysicsManager;
|
|
||||||
|
|
||||||
namespace OpenSim.world
|
namespace OpenSim.world
|
||||||
{
|
{
|
||||||
public class Avatar : Entity
|
public class Avatar : Entity
|
||||||
{
|
{
|
||||||
public string firstname;
|
public string firstname;
|
||||||
public string lastname;
|
public string lastname;
|
||||||
public OpenSimClient ControllingClient;
|
public OpenSimClient ControllingClient;
|
||||||
private PhysicsActor _physActor;
|
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
|
||||||
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
|
|
||||||
private bool updateflag;
|
public Avatar(OpenSimClient TheClient) {
|
||||||
private bool walking;
|
Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
||||||
private List<NewForce> forcesList = new List<NewForce>();
|
ControllingClient=TheClient;
|
||||||
|
SetupTemplate("avatar-template.dat");
|
||||||
public Avatar(OpenSimClient TheClient) {
|
}
|
||||||
Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
|
||||||
ControllingClient=TheClient;
|
private void SetupTemplate(string name)
|
||||||
SetupTemplate("avatar-template.dat");
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhysicsActor PhysActor
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
this._physActor = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public override void addFroces()
|
|
||||||
{
|
{
|
||||||
if(this.forcesList.Count>0)
|
|
||||||
{
|
int i = 0;
|
||||||
for(int i=0 ; i < this.forcesList.Count; i++)
|
FileInfo fInfo = new FileInfo(name);
|
||||||
{
|
long numBytes = fInfo.Length;
|
||||||
NewForce force = this.forcesList[i];
|
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
||||||
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
|
BinaryReader br = new BinaryReader(fStream);
|
||||||
this.PhysActor.Velocity = phyVector;
|
byte [] data1 = br.ReadBytes((int)numBytes);
|
||||||
this.updateflag = true;
|
br.Close();
|
||||||
this.velocity = new Axiom.MathLib.Vector3(force.X, force.Y, force.Z); //shouldn't really be doing this
|
fStream.Close();
|
||||||
// but as we are setting the velocity (rather than using real forces) at the moment it is okay.
|
|
||||||
|
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
|
||||||
}
|
|
||||||
}
|
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||||
|
libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
|
||||||
|
pos.X = 100f;
|
||||||
|
objdata.ID = 8880000;
|
||||||
|
objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
|
||||||
|
libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f);
|
||||||
|
//objdata.FullID=user.AgentID;
|
||||||
|
byte[] pb = pos.GetBytes();
|
||||||
|
Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
|
||||||
|
|
||||||
|
AvatarTemplate = objdata;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void update()
|
|
||||||
{
|
|
||||||
if(this.updateflag)
|
|
||||||
{
|
|
||||||
//need to send movement info
|
|
||||||
//so create the improvedterseobjectupdate packet
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetupTemplate(string name)
|
public void CompleteMovement(World RegionInfo) {
|
||||||
{
|
Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
|
||||||
|
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
||||||
int i = 0;
|
mov.AgentData.SessionID = this.ControllingClient.SessionID;
|
||||||
FileInfo fInfo = new FileInfo(name);
|
mov.AgentData.AgentID = this.ControllingClient.AgentID;
|
||||||
long numBytes = fInfo.Length;
|
mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||||
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
// TODO - dynamicalise this stuff
|
||||||
BinaryReader br = new BinaryReader(fStream);
|
mov.Data.Timestamp = 1172750370;
|
||||||
byte [] data1 = br.ReadBytes((int)numBytes);
|
mov.Data.Position = new LLVector3(100f, 100f, 23f);
|
||||||
br.Close();
|
mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
|
||||||
fStream.Close();
|
|
||||||
|
Console.WriteLine("Sending AgentMovementComplete packet");
|
||||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
|
ControllingClient.OutPacket(mov);
|
||||||
|
}
|
||||||
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
|
||||||
libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
|
|
||||||
pos.X = 100f;
|
|
||||||
objdata.ID = 8880000;
|
|
||||||
objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
|
|
||||||
libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f);
|
|
||||||
//objdata.FullID=user.AgentID;
|
|
||||||
byte[] pb = pos.GetBytes();
|
|
||||||
Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
|
|
||||||
|
|
||||||
AvatarTemplate = objdata;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CompleteMovement(World RegionInfo) {
|
public void SendInitialPosition() {
|
||||||
Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
|
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
|
||||||
mov.AgentData.SessionID = this.ControllingClient.SessionID;
|
|
||||||
mov.AgentData.AgentID = this.ControllingClient.AgentID;
|
|
||||||
mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
|
||||||
// TODO - dynamicalise this stuff
|
|
||||||
mov.Data.Timestamp = 1172750370;
|
|
||||||
mov.Data.Position = new LLVector3(100f, 100f, 23f);
|
|
||||||
mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
|
|
||||||
|
|
||||||
Console.WriteLine("Sending AgentMovementComplete packet");
|
|
||||||
ControllingClient.OutPacket(mov);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendInitialPosition() {
|
//send a objectupdate packet with information about the clients avatar
|
||||||
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
|
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||||
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
|
objupdate.ObjectData[0] = AvatarTemplate;
|
||||||
|
//give this avatar object a local id and assign the user a name
|
||||||
|
objupdate.ObjectData[0].ID = 8880000 + OpenSim_Main.local_world._localNumber;
|
||||||
|
//User_info.name="Test"+this.local_numer+" User";
|
||||||
|
objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
|
||||||
|
objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
|
||||||
|
|
||||||
|
libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 23.0f);
|
||||||
|
|
||||||
|
byte[] pb = pos2.GetBytes();
|
||||||
|
|
||||||
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||||
|
OpenSim_Main.local_world._localNumber++;
|
||||||
|
this.ControllingClient.OutPacket(objupdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendInitialAppearance() {
|
||||||
|
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
|
||||||
|
aw.AgentData.AgentID = this.ControllingClient.AgentID;
|
||||||
|
aw.AgentData.SerialNum = 0;
|
||||||
|
aw.AgentData.SessionID = ControllingClient.SessionID;
|
||||||
|
|
||||||
|
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
|
||||||
|
AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock();
|
||||||
|
awb.WearableType = (byte)0;
|
||||||
|
awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||||
|
awb.ItemID = LLUUID.Random();
|
||||||
|
aw.WearableData[0] = awb;
|
||||||
|
|
||||||
|
for(int i=1; i<13; i++) {
|
||||||
|
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
|
||||||
|
awb.WearableType = (byte)i;
|
||||||
|
awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
aw.WearableData[i] = awb;
|
||||||
|
}
|
||||||
|
|
||||||
|
ControllingClient.OutPacket(aw);
|
||||||
|
}
|
||||||
|
|
||||||
//send a objectupdate packet with information about the clients avatar
|
public void SendRegionHandshake(World RegionInfo) {
|
||||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
Console.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
|
||||||
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
objupdate.RegionData.TimeDilation = 64096;
|
RegionHandshakePacket handshake = new RegionHandshakePacket();
|
||||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
|
||||||
|
Console.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
|
||||||
objupdate.ObjectData[0] = AvatarTemplate;
|
handshake.RegionInfo.BillableFactor = 0;
|
||||||
//give this avatar object a local id and assign the user a name
|
handshake.RegionInfo.IsEstateManager = false;
|
||||||
objupdate.ObjectData[0].ID = 8880000 + OpenSim_Main.local_world._localNumber;
|
handshake.RegionInfo.TerrainHeightRange00 = 60;
|
||||||
//User_info.name="Test"+this.local_numer+" User";
|
handshake.RegionInfo.TerrainHeightRange01 = 60;
|
||||||
objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
|
handshake.RegionInfo.TerrainHeightRange10 = 60;
|
||||||
objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
|
handshake.RegionInfo.TerrainHeightRange11 = 60;
|
||||||
|
handshake.RegionInfo.TerrainStartHeight00 = 10;
|
||||||
libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 23.0f);
|
handshake.RegionInfo.TerrainStartHeight01 = 10;
|
||||||
|
handshake.RegionInfo.TerrainStartHeight10 = 10;
|
||||||
byte[] pb = pos2.GetBytes();
|
handshake.RegionInfo.TerrainStartHeight11 = 10;
|
||||||
|
handshake.RegionInfo.SimAccess = 13;
|
||||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
handshake.RegionInfo.WaterHeight = 5;
|
||||||
OpenSim_Main.local_world._localNumber++;
|
handshake.RegionInfo.RegionFlags = 72458694;
|
||||||
this.ControllingClient.OutPacket(objupdate);
|
handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0");
|
||||||
}
|
handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||||
public void SendInitialAppearance() {
|
handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||||
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
|
handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
||||||
aw.AgentData.AgentID = this.ControllingClient.AgentID;
|
handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
||||||
aw.AgentData.SerialNum = 0;
|
handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
aw.AgentData.SessionID = ControllingClient.SessionID;
|
handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
|
handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
|
handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock();
|
handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
|
||||||
awb.WearableType = (byte)0;
|
|
||||||
awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
Console.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
|
||||||
awb.ItemID = LLUUID.Random();
|
this.ControllingClient.OutPacket(handshake);
|
||||||
aw.WearableData[0] = awb;
|
}
|
||||||
|
|
||||||
for(int i=1; i<13; i++) {
|
|
||||||
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
|
|
||||||
awb.WearableType = (byte)i;
|
|
||||||
awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
|
||||||
awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
|
||||||
aw.WearableData[i] = awb;
|
|
||||||
}
|
|
||||||
|
|
||||||
ControllingClient.OutPacket(aw);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleUpdate(AgentUpdatePacket pack) {
|
|
||||||
if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) {
|
|
||||||
if(!walking)
|
|
||||||
{
|
|
||||||
//we should add a new force to the list
|
|
||||||
// but for now we will deal with velocities
|
|
||||||
NewFoce newVelocity = new NewForce();
|
|
||||||
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
|
|
||||||
Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
|
|
||||||
Axiom.MathLib.Vector3 direc = q * v3;
|
|
||||||
direc.Normalize();
|
|
||||||
|
|
||||||
Axiom.MathLib.Vector3 internDirec = new Vector3(direc.x, direc.y, direc.z);
|
|
||||||
|
|
||||||
//work out velocity for sim physics system
|
|
||||||
direc = direc * ((0.03f) * 128f);
|
|
||||||
newVelocity.X = direc.x;
|
|
||||||
newVelocity.Y = direc.y;
|
|
||||||
newVelocity.Z = direc.z;
|
|
||||||
this.forcesList.Add(newVelocity);
|
|
||||||
walking=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(walking)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//should be moved somewhere else
|
|
||||||
public void SendRegionHandshake(World RegionInfo) {
|
|
||||||
Console.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
|
|
||||||
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
|
||||||
RegionHandshakePacket handshake = new RegionHandshakePacket();
|
|
||||||
|
|
||||||
Console.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
|
|
||||||
handshake.RegionInfo.BillableFactor = 0;
|
|
||||||
handshake.RegionInfo.IsEstateManager = false;
|
|
||||||
handshake.RegionInfo.TerrainHeightRange00 = 60;
|
|
||||||
handshake.RegionInfo.TerrainHeightRange01 = 60;
|
|
||||||
handshake.RegionInfo.TerrainHeightRange10 = 60;
|
|
||||||
handshake.RegionInfo.TerrainHeightRange11 = 60;
|
|
||||||
handshake.RegionInfo.TerrainStartHeight00 = 10;
|
|
||||||
handshake.RegionInfo.TerrainStartHeight01 = 10;
|
|
||||||
handshake.RegionInfo.TerrainStartHeight10 = 10;
|
|
||||||
handshake.RegionInfo.TerrainStartHeight11 = 10;
|
|
||||||
handshake.RegionInfo.SimAccess = 13;
|
|
||||||
handshake.RegionInfo.WaterHeight = 5;
|
|
||||||
handshake.RegionInfo.RegionFlags = 72458694;
|
|
||||||
handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0");
|
|
||||||
handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
|
|
||||||
handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
|
||||||
handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
|
||||||
handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
|
||||||
handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
|
||||||
handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
|
||||||
handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
|
||||||
handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
|
||||||
handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
|
||||||
handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
|
|
||||||
|
|
||||||
Console.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
|
|
||||||
this.ControllingClient.OutPacket(handshake);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class NewForce
|
|
||||||
{
|
|
||||||
public float X;
|
|
||||||
public float Y;
|
|
||||||
public float Z;
|
|
||||||
|
|
||||||
public NewForce()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ namespace OpenSim.world
|
||||||
public class Entity
|
public class Entity
|
||||||
{
|
{
|
||||||
protected libsecondlife.LLUUID uuid;
|
protected libsecondlife.LLUUID uuid;
|
||||||
public Vector3 position;
|
protected Vector3 position;
|
||||||
public Vector3 velocity;
|
protected Vector3 velocity;
|
||||||
public Quaternion rotation;
|
protected Quaternion rotation;
|
||||||
protected string name;
|
protected string name;
|
||||||
protected List<Entity> children;
|
protected List<Entity> children;
|
||||||
|
|
||||||
|
@ -24,13 +24,7 @@ namespace OpenSim.world
|
||||||
name = "(basic entity)";
|
name = "(basic entity)";
|
||||||
children = new List<Entity>();
|
children = new List<Entity>();
|
||||||
}
|
}
|
||||||
public virtual void addFroces()
|
|
||||||
{
|
|
||||||
foreach (Entity child in children)
|
|
||||||
{
|
|
||||||
child.addFroces();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public virtual void update() {
|
public virtual void update() {
|
||||||
// Do any per-frame updates needed that are applicable to every type of entity
|
// Do any per-frame updates needed that are applicable to every type of entity
|
||||||
foreach (Entity child in children)
|
foreach (Entity child in children)
|
||||||
|
|
|
@ -3,7 +3,6 @@ using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using PhysicsManager;
|
|
||||||
|
|
||||||
namespace OpenSim.world
|
namespace OpenSim.world
|
||||||
{
|
{
|
||||||
|
@ -14,8 +13,6 @@ namespace OpenSim.world
|
||||||
public ScriptEngine Scripts;
|
public ScriptEngine Scripts;
|
||||||
public TerrainDecode terrainengine = new TerrainDecode();
|
public TerrainDecode terrainengine = new TerrainDecode();
|
||||||
public uint _localNumber=0;
|
public uint _localNumber=0;
|
||||||
private PhysicsScene phyScene;
|
|
||||||
private float timeStep= 0.1f;
|
|
||||||
|
|
||||||
private Random Rand = new Random();
|
private Random Rand = new Random();
|
||||||
|
|
||||||
|
@ -35,30 +32,9 @@ namespace OpenSim.world
|
||||||
// Initialise this only after the world has loaded
|
// Initialise this only after the world has loaded
|
||||||
Scripts = new ScriptEngine(this);
|
Scripts = new ScriptEngine(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsScene PhysScene
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
this.phyScene = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if(this.phyScene.IsThreaded)
|
|
||||||
{
|
|
||||||
this.phyScene.GetResults();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
|
||||||
{
|
|
||||||
Entities[UUID].addFroces();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.phyScene.Simulate(timeStep);
|
|
||||||
|
|
||||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||||
{
|
{
|
||||||
Entities[UUID].update();
|
Entities[UUID].update();
|
||||||
|
@ -79,9 +55,7 @@ namespace OpenSim.world
|
||||||
this.Entities.Add(AgentClient.AgentID, NewAvatar);
|
this.Entities.Add(AgentClient.AgentID, NewAvatar);
|
||||||
Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
|
Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
|
||||||
NewAvatar.SendRegionHandshake(this);
|
NewAvatar.SendRegionHandshake(this);
|
||||||
|
this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
|
||||||
NewAvatar.PhysActor = this.phyScene.AddAvatar(new PhysicsVector(NewAvatar.position.x, NewAvatar.position.y, NewAvatar.position.z));
|
|
||||||
//this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Backup() {
|
public bool Backup() {
|
||||||
|
|
Loading…
Reference in New Issue