Public feed #378170

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-03-02 09:35 UTC
rendered paste body
UpdateCommand newCommand = new UpdateCommand();
							newCommand.CommandType = 1;
							newCommand.SObject = avatar;
							//start walking
							Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
							Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(updatePacket.AgentData.BodyRotation.W, updatePacket.AgentData.BodyRotation.X, updatePacket.AgentData.BodyRotation.Y, updatePacket.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);
							//because of us using a frame based system we can't update the avatar directly
							//so we need to add the command to the list and let the update loop deal with it
							newCommand.Velocity = new libsecondlife.LLVector3(0, 0 , 0);
							newCommand.Velocity.X = direc.x;
							newCommand.Velocity.Y = direc.y;
							newCommand.Velocity.Z = direc.z;
							
							//work out velocity for clients movement commands
							internDirec = internDirec * (0.03f);
							internDirec.x += 1;
							internDirec.y += 1;
							internDirec.z += 1;
							
							newCommand.InternVelocityX = (ushort)(32768 * internDirec.x);
							newCommand.InternVelocityY = (ushort)(32768 * internDirec.y);
							newCommand.InternVelocityZ = (ushort)(32768 * internDirec.z);