Small grid Interior and Rotating Light GetPosition() gives the wrong position.

Xardkort shared this bug 8 months ago
Reported

The screenshot shows that the position of the interior/rotating light is shifted by one meter from where it should be.

The attached script will help you reproduce the problem. Just place an LCD panel (GPS will be displayed on it), interior light and rotating light on a small grid and run the script.

        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.Update10;
        }
        public void Main(string argument, UpdateType updateSource)
        {
            var lights = new List<IMyLightingBlock>();
            GridTerminalSystem.GetBlocksOfType(lights);
            if (lights.Count > 0)
            {
                var debug = "";
                foreach (var l in lights) debug += PosToGps(l.CustomName, l.GetPosition()) + "\n";
                var lcds = new List<IMyTextPanel>();
                GridTerminalSystem.GetBlocksOfType(lcds);
                foreach (var l in lcds) l.WriteText(debug);
            }

        }
        public string PosToGps(string name, Vector3D pos) => $"GPS:{name}:{pos.X}:{pos.Y}:{pos.Z}:#FF75C9F1";

Replies (2)

photo
1

I forgot to add changing the contentType of the lcd panel to the code.

You can fix it manually by replacing "no content" with "text and image" in the "content" section of the lcd settings in the terminal.

Or replace this code:

foreach (var l in lcds) l.WriteText(debug);
with this:
foreach (var l in lcds)
{
    l.ContentType = ContentType.TEXT_AND_IMAGE;
    l.WriteText(debug);
}

photo
1

Hello, Xardkort!

Thank you for reaching our forum with this issue.

Issue was successfully reproduced on our side and reported into our internal system.

Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file