Space Engineers

Space Engineers

Radar
mezz 10. okt. 2015 kl. 16.36
Using Radars with Programmable Blocks?
Hey there, I've been looking for a neat little mod like this in order to toy around with some missile stuff of mine and wondered if there is a way to retrieve a list of scanned items within the context of a programmable block, and if not if I could get my hopes up for it in the future, as it'd allow me to do entirely new stuff I couldn't do before.
< >
Viser 12 av 2 kommentarer
Solraven 28. jan. 2016 kl. 2.11 
maybe if it could create gps coordinance in the gps menu with each having its own name (and updated every second or so) than you could set a remote block to go to that target. than use a sesor to switch to laser guidence when it gets close enough.
N00bKeper 12. apr. 2017 kl. 8.54 
If you iterated over each line using something like:

String[] gpsOutput = (IMyTextPanel)RadarOutput.Split('\n');

This would return an array of strings, each containing on entry from the LCD Panel.

Example Item in Array: GPS:Radar - Tiny Ship:37264:151339:-132709: - {X:0.5 Y:3 Z:5.5}

You could then separate each entry by using a for or foreach loop: :

foreach(string str in gpsOutput) { string[] coord = str.Split('-')[2]; /* Splits string into 3 elements (Arrays are 0 Indexed): 0) "GPS: Radar" 1) "Tiny Ship:37264:151339:-132709:" 2) "{X:0.5 Y:3 Z:5.5}" Then selects the 2 element: "Tiny Ship:37264:151339:-132709:" Next you need to split that string by the ':'. The result is: 0) "Tiny Ship" 1) "37264" 2) "151339" 3) "-132709" 4) " " You can then assign those to a double value using double.Parse and the index of the value */ double x = double.Parse(coord.Split(':')[1]); double y = double.Parse(coord.Split(':')[2]); double z = double.Parse(coord.Split(':')[3]); }

One of the classes in VRage.Math is Vector3D that can make the double X,Y,Z values useful by other parts of the PB and to the Remote Control Block:

Vector3D newGPS = new Vector3D(x,y,z);

Once you have the Vector you can do what you want with it. I might recommend using the nested class in iMyRemoteControl called MyWaypointInfo. This takes a string for the name and the Vector3D coordinate that we created.

MyWaypointInfo waypoint = new MyWaypointInfo(string, Vector3D);

At this point you could now use it with the Remote Control block to track or navigate to various places in your world.
< >
Viser 12 av 2 kommentarer
Per side: 1530 50