Space Engineers

Space Engineers

Not enough ratings
Raycast Lidar
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
509.777 KB
27 Jul, 2021 @ 7:42pm
1 Jan, 2022 @ 1:40pm
4 Change Notes ( view )

Subscribe to download
Raycast Lidar

Description
Simple script using raycast vanilla camera. The GPS of the found target is placed in the CustomData camera and can be used for further automation, for example, firing torpedoes.

Main features

1. measuring distance to object / target
2. setting the scanning range
3. transferring GPS coordinates of the found target to the autopilot (if installed)
4. calling a given program block with a parameter or GPS target

Installation and configuration
For the script to work, the following are required:

a) program block
b) ship controller (cockpit, remote control, pilot's seat)
c) camera (not behind glass)

The installation of the script code into the program unit is carried out by subscription in Steam. After saving the code, add the same "lidar" prefix (by default) to the name of the camera and LCD panel to display information. The output can be carried out on the screen of the cockpit or the pilot's seat; for this, the prefix must also be added to the cockpit name. The script works on demand and does not use the system timer, which makes it convenient for use on servers.

Usage
  • If the variable autopilot is not equal to 0, then the script transfers the target coordinates to the autopilot installed on the same grid as the PB, the GPS target coordinates. Waypoint is put on autopilot under the name "Lidar". The autopilot is manually activated if necessary.

  • You can make a sight out of a transparent LCD panel using a variable sight. If it is not equal to "", then its contents will be displayed when the script is initialized and the target is rescanned. This is convenient for scripts to control custom turrets like MART.

  • Custom Data of camera lidar can be easily adapted to launch missiles of the same type using automatic guidance and control scripts type Easy Lidar Homing Script

An example of such use is published in the workshop.

Description of parameters and settings in the header of the script. Comments and questions are welcome.

12 Comments
Survival Ready  [author] 24 Mar, 2022 @ 8:58am 
You did the right thing. The peculiarity of the work of Raycast is related to how far the scanning will be performed at the time of initialization. For example, with a range of 15 km, it takes me about 7 seconds for the initial scan, but then everything works quickly.

Since you are printing drones, every time the drone runs the script for the first time, you will experience this delay.
Nikki 23 Mar, 2022 @ 9:41am 
I seem to have mostly fixed the issue by setting the scan range to just 3000m. Maybe it had something to do with there being too much ground to scan. Anycase it seems to be way more reliable now!
Nikki 21 Mar, 2022 @ 10:34am 
It sometimes keeps giving me the nothing found in *insert max range*, despite multiple attemts. If i try to do it in a diffrend scenario it suddenly works fine. Idk if it has to do with the terrain somehow blocking the beam? Perhaps im just missing the beam due to server or something.

If you want to help heres the blueprint, its a simple drone carrier for pvp rover only server. Each drone has your script on it, bound to scan on the number 2. The lcd has to be viewed from first person which is a flaw i have to fix.

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2782630844
Survival Ready  [author] 21 Mar, 2022 @ 7:48am 
Lidar works by the point where the beam touches the object. What exactly are the problems and what is displayed?
Nikki 21 Mar, 2022 @ 6:31am 
Eady to use script. I use it for launching wheeled drones out of a large rover. Tough i do seem to sometimes have some inconsistent trouple trying to tag a grid with the scan.
RandomGuy0400 10 Mar, 2022 @ 8:18am 
that's what I was trying to use it for, i like to use the camera because if i just point my crosshairs at an object from the cockpit, I won't always get an accurate distance reading or even any distance reading, so I control the thing from the camera so my crosshairs actually line up with what the camera sees, so im looking at the same point as the camera
Survival Ready  [author] 10 Mar, 2022 @ 8:06am 
In general, you are right, but this script was developed primarily for reconnaissance of asteroids in space, where it is not always possible to determine by eye which one is closer, and then it was extended to fire, among other things, missiles guided by GPS coordinates.
RandomGuy0400 10 Mar, 2022 @ 6:08am 
Well the whole reason I put the lcds by the camera instead of just In the cockpit is because I don't like dealing with the offset introduced by aiming using anything other than the same camera that performs the raycast...
I guess I'll just have to change the zoom when I want to read the lcd vs when I'm trying to see a distant target or just traveling
Survival Ready  [author] 10 Mar, 2022 @ 1:53am 
I understand what you want. This problem is solved not by two LCD-displays, but by two cameras. One of which is located behind a transparent screen and is used for guidance, and the second is used for lidar. The distance to the target is displayed on a transparent screen, and you will see it through the first camera. You can see the solution here https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2613143288 it might work for you. True, for this you will have to print the tank, or it may be enough for you to look at the last picture in the gallery.

A transparent screen is a block like any other. Therefore, the lidar beam does not pass through it and the lidar will always give the distance to it and not to the target. This is the mechanics of the game.
RandomGuy0400 9 Mar, 2022 @ 3:31pm 
I mean is there a way I could modify the script to be able to display on a second screen without having to rewrite the whole thing? Normally I'd just have put a transparent lcd in front of the camera, but you said it can't have glass in front of it...