public static bool IsWorthMeshing(SimObjectImpl impl) { Vector3d GlobalPosition; //GridClient client = GridClientMaster; //if (client == null) return true; if (impl.TryGetGlobalPosition(out GlobalPosition)) { bool atLeastOnBC = false; foreach (var client in ClientManager.KnownBotClients) { if (!client.IsLoggedInAndReady) { continue; } ; double d = Vector3d.Distance(GlobalPosition, client.Self.GlobalPosition); if (d < WorldPathSystem.WorthMeshingDistance) { return(true); } atLeastOnBC = true; } if (!atLeastOnBC) { return(true); } } return(false); }
public static bool IsWorthMeshing(SimObjectImpl impl) { Vector3d GlobalPosition; //GridClient client = GridClientMaster; //if (client == null) return true; if (impl.TryGetGlobalPosition(out GlobalPosition)) { bool atLeastOnBC = false; foreach (var client in ClientManager.KnownBotClients) { if (!client.IsLoggedInAndReady) continue; ; double d = Vector3d.Distance(GlobalPosition, client.Self.GlobalPosition); if (d < WorldPathSystem.WorthMeshingDistance) { return true; } atLeastOnBC = true; } if (!atLeastOnBC) return true; } return false; }
internal SimObject CreateSimObject(UUID uuid, WorldObjects WO, Simulator simulator) { if (uuid == UUID.Zero) { throw new NullReferenceException("UUID.Zero!"); } // lock (GetSimObjectLock) SimObject obj0 = GetSimObjectFromUUID(uuid); if (obj0 != null) return obj0; simulator = simulator ?? client.Network.CurrentSim; lock (GetSimLock(simulator ?? client.Network.CurrentSim)) //lock (UUIDTypeObjectLock) // lock (SimObjects) // lock (SimAvatars) { obj0 = GetSimObjectFromUUID(uuid); if (obj0 != null) return obj0; obj0 = new SimObjectImpl(uuid, WO, simulator); SimObjects.AddTo(obj0); RegisterUUID(uuid, obj0); return obj0; } }
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 + ".")); } } }