public string describeAvatar(Avatar avatar) { // string verb; //if (avatar.SittingOn == 0) // verb = "standing"; //else // verb = "sitting"; //WriteLine(avatar.Name + " is " + verb + " in " + avatar.CurrentSim.Name + "."); if (avatar == null) { return("NULL avatar"); } string s = String.Empty; s += (avatar.Name + " is " + TheSimAvatar.DistanceVectorString(GetSimObject(avatar)) + " distant."); if (!HasValue(avatar.ProfileProperties)) { return(s); } if (avatar.ProfileProperties.BornOn != null) { s += ("Born on: " + avatar.ProfileProperties.BornOn); } if (avatar.ProfileProperties.AboutText != null) { s += ("About their second life: " + avatar.ProfileProperties.AboutText); } if (avatar.ProfileProperties.FirstLifeText != null) { s += ("About their first life: " + avatar.ProfileProperties.FirstLifeText); } if (avatar.ProfileInterests.LanguagesText != null) { s += ("Languages spoken: " + avatar.ProfileInterests.LanguagesText); } if (avatar.ProfileInterests.SkillsText != null) { s += ("Skills: " + avatar.ProfileInterests.SkillsText); } if (avatar.ProfileInterests.WantToText != null) { s += ("Wants to: " + avatar.ProfileInterests.WantToText); } return(s); }
public override CmdResult ExecuteRequest(CmdRequest args) { SimPosition position; if (!args.TryGetValue("is", out position)) { return(Failure("I don't understand how to move " + args.str)); } { double RAD2DEG = 180 / Math.PI; if (position != null) { //avatar = ((SimAvatar)position).theAvatar; //Client.Self.Movement.Camera.AtAxis Vector3d myPos = TheSimAvatar.GlobalPosition; Vector3 forward = new Vector3(1, 0, 0); Vector3d positionVect = position.GlobalPosition; Vector3d offsetG = positionVect - myPos; Vector3 offset = new Vector3((float)offsetG.X, (float)offsetG.Y, (float)offsetG.Z); Quaternion newRot2 = Vector3.RotationBetween(forward, offset); //Quaternion newRot1 = Vector3d.RotationBetween(positionVect, Client.Self.RelativePosition); double newDist = Vector3d.Distance(positionVect, myPos); WriteLine("Where Found: {0}", position); // Absolute WriteLine(" SimPosition = " + Vector3Str(position.SimPosition)); WriteLine(" SimRotation = {0:0.#}*", WorldObjects.GetZHeading(position.SimRotation) * RAD2DEG); // Relative WriteLine(" RelSimPosition = {0} ", Vector3Str(offset)); double relAngle = (Math.Atan2(-offset.X, -offset.Y) + Math.PI); // 2P WriteLine(" RelSimPolar = {0:0.#}*{1:0.0#}", relAngle * RAD2DEG, newDist); double selfFacing = WorldObjects.GetZHeading(TheSimAvatar.SimRotation); WriteLine(" SelfFacingPolar = {0:+0.0#;-0.0#}*{1:0.0#}", (relAngle - selfFacing) * RAD2DEG, newDist); if (false) { //WriteLine(" newRot1 = {0:0.#}*", WorldObjects.GetZHeading(newRot1) * RAD2DEG); //WriteLine(" newRot2 = {0:0.#}*", WorldObjects.GetZHeading(newRot2) * RAD2DEG); WriteLine(" Client.Self.Movement.Camera.AtAxis = " + Vector3Str(Client.Self.Movement.Camera.AtAxis)); WriteLine(" Client.Self.RelativePosition = " + Vector3Str(Client.Self.RelativePosition)); WriteLine(" SelfFacing = {0:0.#}*{1:0.0#}", selfFacing * RAD2DEG, Client.Self.Movement.Camera.AtAxis.Length()); } SimObjectImpl o = position as SimObjectImpl; if (o != null) { position = o.GetHeading(); } //WriteLine(avatar.Rotation.X + ", " + avatar.Rotation.Y + ", " + avatar.Rotation.Z); //WriteLine(Client.Self.RelativeRotation.X + ", " + Client.Self.RelativeRotation.Y + ", " + Client.Self.RelativeRotation.Z + "\n"); return(Success("At: " + position + " " + TheSimAvatar.DistanceVectorString(position))); } else { return(Failure("I don't know where " + args.str + ".")); } } }