Die Avatar class, and you to Primitive class!

merge
MW 2007-05-26 13:51:49 +00:00
parent 3436961bb5
commit 5f62631332
3 changed files with 19 additions and 1100 deletions

View File

@ -11,327 +11,65 @@ namespace OpenSim.world
{
public override void update()
{
if (!this.childAvatar)
{
if (this._physActor == null)
{
//HACKHACK: Note to work out why this entity does not have a physics actor
// and prehaps create one.
return;
}
libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
if (this.updateflag)
{
//need to send movement info
//so create the improvedterseobjectupdate packet
//use CreateTerseBlock()
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock;
List<Avatar> avList = this.m_world.RequestAvatarList();
foreach (Avatar client in avList)
{
client.SendPacketToViewer(terse);
}
updateflag = false;
//this._updateCount = 0;
}
else
{
if ((pos2 != this.positionLastFrame) || (this.movementflag == 16))
{
_updateCount++;
if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0))
{
//It has been a while since last update was sent so lets send one.
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock;
List<Avatar> avList = this.m_world.RequestAvatarList();
foreach (Avatar client in avList)
{
client.SendPacketToViewer(terse);
}
_updateCount = 0;
}
if (this.movementflag == 16)
{
movementflag = 0;
}
}
}
this.positionLastFrame = pos2;
if (!this.ControllingClient.m_sandboxMode)
{
if (pos2.X < 0)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
}
if (pos2.Y < 0)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
}
if (pos2.X > 255)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
}
if (pos2.Y > 255)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
}
}
}
}
public void SendUpdateToOtherClient(Avatar remoteAvatar)
{
ObjectUpdatePacket objupdate = CreateUpdatePacket();
remoteAvatar.SendPacketToViewer(objupdate);
}
public ObjectUpdatePacket CreateUpdatePacket()
{
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
//send a objectupdate packet with information about the clients avatar
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = m_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 = this.localid;
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((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z);
byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
return objupdate;
}
public void SendInitialPosition()
{
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
//send a objectupdate packet with information about the clients avatar
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = m_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 = this.localid;
this.uuid = 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((float)this.Pos.X, (float)this.Pos.Y, (float)this.Pos.Z);
byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
m_world._localNumber++;
List<Avatar> avList = this.m_world.RequestAvatarList();
foreach (Avatar client in avList)
{
client.SendPacketToViewer(objupdate);
if (client.ControllingClient.AgentID != this.ControllingClient.AgentID)
{
SendAppearanceToOtherAgent(client);
}
}
}
public void SendOurAppearance()
{
ControllingClient.SendAppearance(this.Wearables);
}
public void SendOurAppearance(ClientView OurClient)
{
//event handler for wearables request
this.SendOurAppearance();
}
public void SendAppearanceToOtherAgent(Avatar avatarInfo)
{
AvatarAppearancePacket avp = new AvatarAppearancePacket();
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes();
AvatarAppearancePacket.VisualParamBlock avblock = null;
for (int i = 0; i < 218; i++)
{
avblock = new AvatarAppearancePacket.VisualParamBlock();
avblock.ParamValue = visualParams[i];
avp.VisualParam[i] = avblock;
}
avp.Sender.IsTrial = false;
avp.Sender.ID = ControllingClient.AgentID;
avatarInfo.SendPacketToViewer(avp);
}
public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
{
LLObject.TextureEntry tex = new LLObject.TextureEntry(texture, 0, texture.Length);
this.avatarAppearanceTexture = tex;
for (int i = 0; i < visualParam.Length; i++)
{
this.visualParams[i] = visualParam[i].ParamValue;
}
List<Avatar> avList = this.m_world.RequestAvatarList();
foreach (Avatar client in avList)
{
if (client.ControllingClient.AgentID != this.ControllingClient.AgentID)
{
SendAppearanceToOtherAgent(client);
}
}
}
public void StopMovement()
{
this._physActor.Velocity = new PhysicsVector(0, 0, 0);
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock;
List<Avatar> avList = this.m_world.RequestAvatarList();
foreach (Avatar client in avList)
{
client.SendPacketToViewer(terse);
}
}
public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock()
{
byte[] bytes = new byte[60];
int i = 0;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry;
libsecondlife.LLVector3 pos2 = new LLVector3(0, 0, 0);
lock (m_world.LockPhysicsEngine)
{
pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
}
uint ID = this.localid;
bytes[i++] = (byte)(ID % 256);
bytes[i++] = (byte)((ID >> 8) % 256);
bytes[i++] = (byte)((ID >> 16) % 256);
bytes[i++] = (byte)((ID >> 24) % 256);
bytes[i++] = 0;
bytes[i++] = 1;
i += 14;
bytes[i++] = 128;
bytes[i++] = 63;
byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, bytes, i, pb.Length);
i += 12;
ushort InternVelocityX;
ushort InternVelocityY;
ushort InternVelocityZ;
Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
lock (m_world.LockPhysicsEngine)
{
internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z);
}
internDirec = internDirec / 128.0f;
internDirec.x += 1;
internDirec.y += 1;
internDirec.z += 1;
InternVelocityX = (ushort)(32768 * internDirec.x);
InternVelocityY = (ushort)(32768 * internDirec.y);
InternVelocityZ = (ushort)(32768 * internDirec.z);
ushort ac = 32767;
bytes[i++] = (byte)(InternVelocityX % 256);
bytes[i++] = (byte)((InternVelocityX >> 8) % 256);
bytes[i++] = (byte)(InternVelocityY % 256);
bytes[i++] = (byte)((InternVelocityY >> 8) % 256);
bytes[i++] = (byte)(InternVelocityZ % 256);
bytes[i++] = (byte)((InternVelocityZ >> 8) % 256);
//accel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
//rot
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
//rotation vel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
dat.Data = bytes;
return (dat);
}
// Sends animation update
public void SendAnimPack(LLUUID animID, int seq)
{
AvatarAnimationPacket ani = new AvatarAnimationPacket();
ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
ani.AnimationSourceList[0].ObjectID = ControllingClient.AgentID;
ani.Sender = new AvatarAnimationPacket.SenderBlock();
ani.Sender.ID = ControllingClient.AgentID;
ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1];
ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
ani.AnimationList[0].AnimID = this.current_anim = animID;
ani.AnimationList[0].AnimSequenceID = this.anim_seq = seq;
List<Avatar> avList = this.m_world.RequestAvatarList();
foreach (Avatar client in avList)
{
client.SendPacketToViewer(ani);
}
}
public void SendAnimPack()
{
this.SendAnimPack(this.current_anim, this.anim_seq);
}
}

View File

@ -109,109 +109,24 @@ namespace OpenSim.world
public override void addForces()
{
lock (this.forcesList)
{
if (this.forcesList.Count > 0)
{
for (int i = 0; i < this.forcesList.Count; i++)
{
NewForce force = this.forcesList[i];
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
lock (m_world.LockPhysicsEngine)
{
this._physActor.Velocity = phyVector;
}
this.updateflag = true;
this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
// but as we are setting the velocity (rather than using real forces) at the moment it is okay.
}
for (int i = 0; i < this.forcesList.Count; i++)
{
this.forcesList.RemoveAt(0);
}
}
}
}
public static void SetupTemplate(string name)
{
FileInfo fInfo = new FileInfo(name);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);
byte[] data1 = br.ReadBytes((int)numBytes);
br.Close();
fStream.Close();
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
SetDefaultPacketValues(objdata);
objdata.TextureEntry = data1;
objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
objdata.PathCurve = 16;
objdata.ProfileCurve = 1;
objdata.PathScaleX = 100;
objdata.PathScaleY = 100;
objdata.ParentID = 0;
objdata.OwnerID = LLUUID.Zero;
objdata.Scale = new LLVector3(1, 1, 1);
objdata.PCode = 47;
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);
Avatar.AvatarTemplate = objdata;
}
protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
{
objdata.PSBlock = new byte[0];
objdata.ExtraParams = new byte[1];
objdata.MediaURL = new byte[0];
objdata.NameValue = new byte[0];
objdata.Text = new byte[0];
objdata.TextColor = new byte[4];
objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
objdata.JointPivot = new LLVector3(0, 0, 0);
objdata.Material = 4;
objdata.TextureAnim = new byte[0];
objdata.Sound = LLUUID.Zero;
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
objdata.TextureEntry = ntex.ToBytes();
objdata.State = 0;
objdata.Data = new byte[0];
objdata.ObjectData = new byte[76];
objdata.ObjectData[15] = 128;
objdata.ObjectData[16] = 63;
objdata.ObjectData[56] = 128;
objdata.ObjectData[61] = 102;
objdata.ObjectData[62] = 40;
objdata.ObjectData[63] = 61;
objdata.ObjectData[64] = 189;
}
public void CompleteMovement()
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.AgentData.SessionID = this.ControllingClient.SessionID;
mov.AgentData.AgentID = this.ControllingClient.AgentID;
mov.Data.RegionHandle = this.m_regionHandle;
// TODO - dynamicalise this stuff
mov.Data.Timestamp = 1172750370;
mov.Data.Position = this.ControllingClient.startpos;
mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
ControllingClient.OutPacket(mov);
}
public void HandleAgentUpdate(Packet pack)
@ -221,194 +136,13 @@ namespace OpenSim.world
public void HandleUpdate(AgentUpdatePacket pack)
{
if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0)
{
if (this._physActor.Flying == false)
{
this.current_anim = Animations.AnimsLLUUID["ANIM_AGENT_FLY"];
this.anim_seq = 1;
this.SendAnimPack();
}
this._physActor.Flying = true;
}
else
{
if (this._physActor.Flying == true)
{
this.current_anim = Animations.AnimsLLUUID["ANIM_AGENT_STAND"];
this.anim_seq = 1;
this.SendAnimPack();
}
this._physActor.Flying = false;
}
if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 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);
if (((movementflag & 1) == 0) || (q != this.bodyRot))
{
if (((movementflag & 1) == 0) && (!this._physActor.Flying))
{
this.current_anim = Animations.AnimsLLUUID["ANIM_AGENT_WALK"];
this.anim_seq = 1;
this.SendAnimPack();
}
//we should add a new force to the list
// but for now we will deal with velocities
NewForce newVelocity = new NewForce();
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
Axiom.MathLib.Vector3 direc = q * v3;
direc.Normalize();
//work out velocity for sim physics system
direc = direc * ((0.03f) * 128f);
if (this._physActor.Flying)
direc *= 4;
newVelocity.X = direc.x;
newVelocity.Y = direc.y;
newVelocity.Z = direc.z;
this.forcesList.Add(newVelocity);
movementflag = 1;
this.bodyRot = q;
}
}
else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying))
{
if (((movementflag & 2) == 0) && this._physActor.Flying)
{
//we should add a new force to the list
// but for now we will deal with velocities
NewForce newVelocity = new NewForce();
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1);
Axiom.MathLib.Vector3 direc = v3;
direc.Normalize();
//work out velocity for sim physics system
direc = direc * ((0.03f) * 128f * 2);
newVelocity.X = direc.x;
newVelocity.Y = direc.y;
newVelocity.Z = direc.z;
this.forcesList.Add(newVelocity);
movementflag = 2;
}
}
else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying))
{
if (((movementflag & 4) == 0) && this._physActor.Flying)
{
//we should add a new force to the list
// but for now we will deal with velocities
NewForce newVelocity = new NewForce();
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1);
//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 = v3;
direc.Normalize();
//work out velocity for sim physics system
direc = direc * ((0.03f) * 128f * 2);
newVelocity.X = direc.x;
newVelocity.Y = direc.y;
newVelocity.Z = direc.z;
this.forcesList.Add(newVelocity);
movementflag = 4;
}
}
else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 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);
if (((movementflag & 8) == 0) || (q != this.bodyRot))
{
//we should add a new force to the list
// but for now we will deal with velocities
NewForce newVelocity = new NewForce();
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0);
Axiom.MathLib.Vector3 direc = q * v3;
direc.Normalize();
//work out velocity for sim physics system
direc = direc * ((0.03f) * 128f);
if (this._physActor.Flying)
direc *= 2;
newVelocity.X = direc.x;
newVelocity.Y = direc.y;
newVelocity.Z = direc.z;
this.forcesList.Add(newVelocity);
movementflag = 8;
this.bodyRot = q;
}
}
else
{
if (movementflag == 16)
{
movementflag = 0;
}
if ((movementflag) != 0)
{
NewForce newVelocity = new NewForce();
newVelocity.X = 0;
newVelocity.Y = 0;
newVelocity.Z = 0;
this.forcesList.Add(newVelocity);
movementflag = 0;
// We're standing still, so make it show!
if (this._physActor.Flying == false)
{
this.current_anim = Animations.AnimsLLUUID["ANIM_AGENT_STAND"];
this.anim_seq = 1;
this.SendAnimPack();
}
this.movementflag = 16;
}
}
}
//really really should be moved somewhere else (RegionInfo.cs ?)
public void SendRegionHandshake(World regionInfo)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
RegionHandshakePacket handshake = new RegionHandshakePacket();
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"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 = m_regionWaterHeight;
uint regionFlags = 72458694;
if (this.m_regionTerraform)
{
regionFlags -= 64;
}
handshake.RegionInfo.RegionFlags = regionFlags;
handshake.RegionInfo.SimName = _enc.GetBytes(m_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");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
this.ControllingClient.OutPacket(handshake);
}
public static void LoadAnims()

View File

@ -12,559 +12,6 @@ namespace OpenSim.world
{
public class Primitive : Entity
{
protected float mesh_cutbegin;
protected float mesh_cutend;
protected PrimData primData;
protected bool newPrimFlag = false;
protected bool updateFlag = false;
protected bool dirtyFlag = false;
private ObjectUpdatePacket OurPacket;
private bool physicsEnabled = false;
private bool physicstest = false;
private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
private Dictionary<uint, ClientView> m_clientThreads;
private ulong m_regionHandle;
private const uint FULL_MASK_PERMISSIONS = 2147483647;
public bool PhysicsEnabled
{
get
{
return physicsEnabled;
}
set
{
physicsEnabled = value;
}
}
public bool UpdateFlag
{
get
{
return updateFlag;
}
set
{
updateFlag = value;
}
}
public LLVector3 Scale
{
set
{
LLVector3 offset = (value - primData.Scale);
offset.X /= 2;
offset.Y /= 2;
offset.Z /= 2;
this.primData.Position += offset;
this.primData.Scale = value;
this.dirtyFlag = true;
}
get
{
return this.primData.Scale;
}
}
public PhysicsActor PhysActor
{
set
{
this._physActor = value;
}
}
public Primitive(Dictionary<uint, ClientView> clientThreads, ulong regionHandle, World world)
{
mesh_cutbegin = 0.0f;
mesh_cutend = 1.0f;
m_clientThreads = clientThreads;
m_regionHandle = regionHandle;
m_world = world;
}
public override Mesh getMesh()
{
Mesh mesh = new Mesh();
Triangle tri = new Triangle(
new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f),
new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f),
new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f));
mesh.AddTri(tri);
mesh += base.getMesh();
return mesh;
}
public byte[] GetByteArray()
{
return this.primData.ToBytes();
}
public void GetProperites(ClientView client)
{
ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
proper.ObjectData[0].ItemID = LLUUID.Zero; // this.uuid;
proper.ObjectData[0].CreationDate = (ulong) this.primData.CreationDate;
proper.ObjectData[0].CreatorID = this.primData.OwnerID;
proper.ObjectData[0].FolderID = LLUUID.Zero;
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
proper.ObjectData[0].GroupID = LLUUID.Zero;
proper.ObjectData[0].InventorySerial = 0;
proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
proper.ObjectData[0].ObjectID = this.uuid;
proper.ObjectData[0].OwnerID = primData.OwnerID;
proper.ObjectData[0].TouchName = new byte[0];
proper.ObjectData[0].TextureID = new byte[0];
proper.ObjectData[0].SitName = new byte[0];
proper.ObjectData[0].Name = new byte[0];
proper.ObjectData[0].Description = new byte[0];
proper.ObjectData[0].OwnerMask = this.primData.OwnerMask;
proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask;
proper.ObjectData[0].GroupMask = this.primData.GroupMask;
proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask;
proper.ObjectData[0].BaseMask = this.primData.BaseMask;
client.OutPacket(proper);
}
public void UpdatePosition(LLVector3 pos)
{
this.Pos = pos;
if (this._physActor != null) // && this.physicsEnabled)
{
try
{
lock (m_world.LockPhysicsEngine)
{
this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
this.updateFlag = true;
}
public override void update()
{
LLVector3 pos2 = new LLVector3(0, 0, 0);
if (this._physActor != null && this.physicsEnabled)
{
PhysicsVector pPos = this._physActor.Position;
pos2 = new LLVector3(pPos.X, pPos.Y, pPos.Z);
}
if (this.newPrimFlag)
{
foreach (ClientView client in m_clientThreads.Values)
{
client.OutPacket(OurPacket);
}
this.newPrimFlag = false;
}
else if (this.updateFlag)
{
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = this.CreateImprovedBlock();
foreach (ClientView client in m_clientThreads.Values)
{
client.OutPacket(terse);
}
this.updateFlag = false;
}
else if (this.dirtyFlag)
{
foreach (ClientView client in m_clientThreads.Values)
{
UpdateClient(client);
}
this.dirtyFlag = false;
}
else
{
if (this._physActor != null && this.physicsEnabled)
{
if (pos2 != this.positionLastFrame)
{
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = this.CreateImprovedBlock();
foreach (ClientView client in m_clientThreads.Values)
{
client.OutPacket(terse);
}
}
this.positionLastFrame = pos2;
}
}
if (this.physicstest)
{
LLVector3 pos = this.Pos;
pos.Z += 0.0001f;
this.UpdatePosition(pos);
this.physicstest = false;
}
}
public void UpdateClient(ClientView RemoteClient)
{
LLVector3 lPos;
if (this._physActor != null && this.physicsEnabled)
{
PhysicsVector pPos = this._physActor.Position;
lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
}
else
{
lPos = this.Pos;
}
byte[] pb = lPos.GetBytes();
Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length);
// OurPacket should be update with the follwing in updateShape() rather than having to do it here
OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID;
OurPacket.ObjectData[0].PCode = this.primData.PCode;
OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin;
OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd;
OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX;
OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY;
OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX;
OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY;
OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew;
OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
OurPacket.ObjectData[0].Scale = this.primData.Scale;
OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve;
OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
OurPacket.ObjectData[0].ParentID = this.primData.ParentID ;
OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
//finish off copying rest of shape data
OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX;
OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY;
OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist;
OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin;
RemoteClient.OutPacket(OurPacket);
}
public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
{
this.primData.PathBegin = addPacket.PathBegin;
this.primData.PathEnd = addPacket.PathEnd;
this.primData.PathScaleX = addPacket.PathScaleX;
this.primData.PathScaleY = addPacket.PathScaleY;
this.primData.PathShearX = addPacket.PathShearX;
this.primData.PathShearY = addPacket.PathShearY;
this.primData.PathSkew = addPacket.PathSkew;
this.primData.ProfileBegin = addPacket.ProfileBegin;
this.primData.ProfileEnd = addPacket.ProfileEnd;
this.primData.PathCurve = addPacket.PathCurve;
this.primData.ProfileCurve = addPacket.ProfileCurve;
this.primData.ProfileHollow = addPacket.ProfileHollow;
this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
this.primData.PathRevolutions = addPacket.PathRevolutions;
this.primData.PathTaperX = addPacket.PathTaperX;
this.primData.PathTaperY = addPacket.PathTaperY;
this.primData.PathTwist = addPacket.PathTwist;
this.primData.PathTwistBegin = addPacket.PathTwistBegin;
this.dirtyFlag = true;
}
public void UpdateTexture(byte[] tex)
{
this.OurPacket.ObjectData[0].TextureEntry = tex;
this.primData.Texture = tex;
this.dirtyFlag = true;
}
public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
{
if (this._physActor != null)
{
if (this._physActor.Kinematic == pack.AgentData.UsePhysics)
{
this._physActor.Kinematic = !pack.AgentData.UsePhysics; //if Usephysics = true, then Kinematic should = false
}
this.physicsEnabled = pack.AgentData.UsePhysics;
if (this._physActor.Kinematic == false)
{
LLVector3 pos = this.Pos;
this.UpdatePosition(pos);
pos.Z += 0.000001f;
this.UpdatePosition(pos);
this.physicstest = true;
}
else
{
PhysicsVector vec = this._physActor.Position;
LLVector3 pos = new LLVector3(vec.X, vec.Y, vec.Z);
this.Pos = pos;
this.updateFlag = true;
}
}
}
public void MakeParent(Primitive prim)
{
this.primData.ParentID = prim.localid;
this.Pos -= prim.Pos;
this.dirtyFlag = true;
}
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
{
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = m_regionHandle;
objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
PrimData PData = new PrimData();
this.primData = PData;
this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
objupdate.ObjectData[0].PSBlock = new byte[0];
objupdate.ObjectData[0].ExtraParams = new byte[1];
objupdate.ObjectData[0].MediaURL = new byte[0];
objupdate.ObjectData[0].NameValue = new byte[0];
objupdate.ObjectData[0].Text = new byte[0];
objupdate.ObjectData[0].TextColor = new byte[4];
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
objupdate.ObjectData[0].Material = 3;
objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
objupdate.ObjectData[0].TextureAnim = new byte[0];
objupdate.ObjectData[0].Sound = LLUUID.Zero;
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
objupdate.ObjectData[0].State = 0;
objupdate.ObjectData[0].Data = new byte[0];
PData.OwnerID = objupdate.ObjectData[0].OwnerID = ownerID;
PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions;
PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX;
PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY;
PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
objupdate.ObjectData[0].ID = (uint)(localID);
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000"));
objupdate.ObjectData[0].ObjectData = new byte[60];
objupdate.ObjectData[0].ObjectData[46] = 128;
objupdate.ObjectData[0].ObjectData[47] = 63;
LLVector3 pos1 = addPacket.ObjectData.RayEnd;
//update position
byte[] pb = pos1.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
this.newPrimFlag = true;
this.primData.FullID = this.uuid = objupdate.ObjectData[0].FullID;
this.localid = objupdate.ObjectData[0].ID;
this.primData.Position = this.Pos = pos1;
this.OurPacket = objupdate;
}
public void CreateFromStorage(PrimData store)
{
this.CreateFromStorage(store, store.Position, store.LocalID, false);
}
public void CreateFromStorage(PrimData store, LLVector3 posi, uint localID, bool newprim)
{
//need to clean this up as it shares a lot of code with CreateFromPacket()
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = m_regionHandle;
objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
this.primData = store;
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
objupdate.ObjectData[0].PSBlock = new byte[0];
objupdate.ObjectData[0].ExtraParams = new byte[1];
objupdate.ObjectData[0].MediaURL = new byte[0];
objupdate.ObjectData[0].NameValue = new byte[0];
objupdate.ObjectData[0].Text = new byte[0];
objupdate.ObjectData[0].TextColor = new byte[4];
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
objupdate.ObjectData[0].Material = 3;
objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
objupdate.ObjectData[0].TextureAnim = new byte[0];
objupdate.ObjectData[0].Sound = LLUUID.Zero;
if (store.Texture == null)
{
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
}
else
{
objupdate.ObjectData[0].TextureEntry = store.Texture;
}
objupdate.ObjectData[0].State = 0;
objupdate.ObjectData[0].Data = new byte[0];
objupdate.ObjectData[0].OwnerID = this.primData.OwnerID;
objupdate.ObjectData[0].PCode = this.primData.PCode;
objupdate.ObjectData[0].PathBegin = this.primData.PathBegin;
objupdate.ObjectData[0].PathEnd = this.primData.PathEnd;
objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX;
objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY;
objupdate.ObjectData[0].PathShearX = this.primData.PathShearX;
objupdate.ObjectData[0].PathShearY = this.primData.PathShearY;
objupdate.ObjectData[0].PathSkew = this.primData.PathSkew;
objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
objupdate.ObjectData[0].Scale = this.primData.Scale;
objupdate.ObjectData[0].PathCurve = this.primData.PathCurve;
objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
objupdate.ObjectData[0].ParentID = 0;
objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
//finish off copying rest of shape data
objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX;
objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY;
objupdate.ObjectData[0].PathTwist = this.primData.PathTwist;
objupdate.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin;
objupdate.ObjectData[0].ID = localID; // (uint)store.LocalID;
objupdate.ObjectData[0].FullID = store.FullID;
objupdate.ObjectData[0].ObjectData = new byte[60];
objupdate.ObjectData[0].ObjectData[46] = 128;
objupdate.ObjectData[0].ObjectData[47] = 63;
LLVector3 pos1 = posi; // store.Position;
//update position
byte[] pb = pos1.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
this.uuid = objupdate.ObjectData[0].FullID;
this.localid = objupdate.ObjectData[0].ID;
this.Pos = pos1;
this.OurPacket = objupdate;
if (newprim)
{
this.newPrimFlag = true;
}
}
public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
{
uint ID = this.localid;
byte[] bytes = new byte[60];
int i = 0;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
//dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry;
dat.TextureEntry = new byte[0];
//Console.WriteLine("texture-entry length in improvedterse block is " + this.OurPacket.ObjectData[0].TextureEntry.Length);
bytes[i++] = (byte)(ID % 256);
bytes[i++] = (byte)((ID >> 8) % 256);
bytes[i++] = (byte)((ID >> 16) % 256);
bytes[i++] = (byte)((ID >> 24) % 256);
bytes[i++] = 0;
bytes[i++] = 0;
LLVector3 lPos;
Axiom.MathLib.Quaternion lRot;
if (this._physActor != null && this.physicsEnabled)
{
PhysicsVector pPos = this._physActor.Position;
lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
lRot = this._physActor.Orientation;
}
else
{
lPos = this.Pos;
lRot = this.rotation;
}
byte[] pb = lPos.GetBytes();
Array.Copy(pb, 0, bytes, i, pb.Length);
i += 12;
ushort ac = 32767;
//vel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
//accel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
ushort rw, rx, ry, rz;
rw = (ushort)(32768 * (lRot.w + 1));
rx = (ushort)(32768 * (lRot.x + 1));
ry = (ushort)(32768 * (lRot.y + 1));
rz = (ushort)(32768 * (lRot.z + 1));
//rot
bytes[i++] = (byte)(rx % 256);
bytes[i++] = (byte)((rx >> 8) % 256);
bytes[i++] = (byte)(ry % 256);
bytes[i++] = (byte)((ry >> 8) % 256);
bytes[i++] = (byte)(rz % 256);
bytes[i++] = (byte)((rz >> 8) % 256);
bytes[i++] = (byte)(rw % 256);
bytes[i++] = (byte)((rw >> 8) % 256);
//rotation vel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
dat.Data = bytes;
return dat;
}
public override void BackUp()
{
this.primData.FullID = this.uuid;
this.primData.LocalID = this.localid;
this.primData.Position = this.Pos;
this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
this.m_world.localStorage.StorePrim(this.primData);
}
}
}