private static void Teleport(IMyEntity entity, LogicComponent target) { Vector3D newPosition = target.Entity.GetPosition() + target.Entity.WorldMatrix.Forward * 3f + target.Offset; //entity.SetPosition(newPosition); MatrixD newPosMatrix = MatrixD.CreateWorld(newPosition, target.Entity.WorldMatrix.Forward, target.Entity.WorldMatrix.Up); entity.Teleport(newPosMatrix); }
private static void Register(LogicComponent teleporter) { if (!TeleporterNetwork.ContainsKey(teleporter.Name)) { TeleporterNetwork.Add(teleporter.Name, teleporter); } else if (TeleporterNetwork[teleporter.Name] != teleporter) { throw new Exception($"There is already a teleporter registered with the name '{teleporter.Name}'!"); } }