Space Engineers

Space Engineers

120 betyg
LiDAR Guided Missile Script
   
Utmärkelse
Favorit
Favoritmarkerad
Avfavoritmarkerad
Filstorlek
Lades upp
Uppdaterades
583.025 KB
19 dec, 2017 @ 12:04
3 feb, 2021 @ 16:02
31 ändringsnotiser ( visa )

Abonnera för att ladda ner
LiDAR Guided Missile Script

Beskrivning
Version 6.6.3 released February 3, 2020

Hello, Engineers! This script can be used with any player-made missile that uses a connector or merge block. The algorithm uses quadratic, cubic, and quartic solutions to lead a target with pin-point accuracy. The script only uses thrusters that push the missile "forward" - and it will compensate for drift accordingly. As such, placing side-facing thrusters on your missiles is purely optional.

The algorithm works in two phases:
  • Accelerating - if the missile and/or the target are accelerating, it will account for this until the speed limit is reached, at which point it will switch to constant speed mode (set this speed in the script).
  • Constant Speed - if the missile and/or the target stop accelerating, it will recompute the time to target accordingly.

What this means: If the distance to target is less than the distance needed to reach maximum velocity, the missile will accurately find the shortest path to lead the target (no curved trajectory). If the distance is greater than the needed distance to velocity, it will adjust trajectory the moment it and/or the target reach maximum velocity.

This script is designed to be used with my LiDAR Mapping Script.

Missile System Setup Video added to the LiDAR Mapping Script Guide!

NEW! Check command added to the missile script. When you've finished building your missile and while it's still disconnected from any other grid, enter "Check" into the PB argument box and press Run. The missile script will run a diagnostic check for you and print out useful information to the PB's Custom Data. You can use this information to help you figure out what you're missing or whether or not you have enough power and / or thrust available on the missile.

Required Items
  • A programmable block with this script
  • An antenna
  • A remote control
  • A thruster
  • A gyro
  • (Optional) A connector / rotor / merge block to attach to firing platform
  • (Optional) As many nukes as you want
  • (Optional) A proximity camera or sensor

NOTE: The script will automatically find all available items above AFTER the missile has successfully disconnected itself from the firing platform. Until such time, the missile is in a sleep cycle to keep from running a PB that isn't being used.

Blueprints
Here are a couple of ready-made blueprints to try out :)
Updates
February 3
  • Removed the 0.1 min limit for clearance power
September 17
  • Added ability to have a timer triggered when a missile is launched - see script config for details
  • Fixed issue with missile antenna being set to max broadcast range on missile launch
  • Adjusted power consumption of antenna for Check command to align with max lidar script range of 10km
  • Check command will now ensure blocks are turned on before retrieving power ratings and then turn them back off if they were off to begin with
September 16
  • Removed requirement for connection block (connector / rotor / merge)
  • Added "Check" command to help users build and troubleshoot missiles
March 9
  • Changed it so that both clearanceTicks and clearanceMeters must be OK before missile can turn
  • Added option to have missiles detonate on kill signal received instead of stop and idle
  • Fixed issue in GetInterceptVector() that returned an infinity vector (leading to NaN and an exception after)
  • Added timer option - script will now trigger timers at a specified distance from the target; see user settings at the top of the script for details
February 9
  • Adjusted missile settings to be more stable in flight (attempt to fix issues caused by jitter)
January 21
  • Fixed an issue where missile roll only activates if useSpiral is set to to true
December 19
  • Removed old antenna code causing an error after the last update
December 3
  • Fixed issue where batteries weren't being turned on before detaching from the firing platform
  • Reworked the initial setup to be more efficient
December 2
  • Fixed bug in message handling. Messages are now received immediately and missiles launch accordingly
  • Removed angle check before firing thrusters when in space
  • Removed gravity subtraction when velocity is greater than max velocity
  • Reworked algorithm setup and added a small buffer to keep missile/target acceleration from bouncing around too much
  • Changed SecondsBeforeSpiral to DistanceBeforeSpiral. Missiles now start to spiral and roll when within a set distance from target

    NOTE This update requires a reload of the LiDAR Mapping Script as well!
October 9
  • Fixed a bug where very small target velocities were causing missiles' intercept vectors to vary wildly
July 9
  • Fixed a bug causing missiles to fail to launch after one successful launch
  • Adjusted the directions missiles take to get out of the firing platform's bounding box
  • Added code to adjust the antenna broadcast range dynamically
June 16
  • Added an Exclude tag to the script. Add this tag to any blocks you don't want the script to use.
June 1
  • Fixed a bug where remote is used before checking if it exists
May 15
  • Adjusted code to allow for redirect of missiles
April 29
  • Updated LCD methods to get rid of the compilation warnings
April 7
  • Adjusted ray collisions method to return earlier if missile is closer to target than to firing platform
  • Missiles will now negate their velocity before killing guidance (no more flying off into the nexus)
March 9
  • Adjusted calculation for pulling up to avoid missile hitting ground
  • Optimized gravity checks
March 6
  • Update Script to SE v1.189 (new commo system)
  • Reworked missile setup - see top portion of script for details (user settings)
January 30
  • Fixed a bug keeping rotor-based missiles from detaching properly
  • Fixed a bug causing missiles to miss the target when in gravity with a stationary target
  • Removed angle check after launch. Missiles are now set to max speed (if not already there) after waiting the designated number of 'ClearanceTicks'
  • Reworked the platform avoidance code to make it a bit 'smarter'
  • Removed unneccessary code
January 28
  • Fixed issue with missiles not avoiding the firing platform
  • Update version to match LiDAR Mapping Script
September 17
  • Added support for proximity sensors for warhead detonation. Missiles can now use a forward-facing camera or a sensor to assist in ensuring warhead detonation when nearing a target.
  • Corrected the gravity calculations for missile guidance. Missiles now more accurately find their target.
  • Fixed a bug with "Roll Speed" and "Toggle Spiral" commands not executing while missile is in flight

See Change Notes for full history

Credits
Thank you to @Whiplash141 for his contributions and guidance on some of the math included in this script.
437 kommentarer
skeleton welder 17 maj @ 10:50 
is there anything i should look out for if my prelaunch timer is not triggering? i have it named and copied into the PB correctly afaik.
re206 2 jan @ 23:16 
Hello! Why atmospheric rockets may not be launched? Blueprint of Sensor Version: LiDAR Platform with Sensor working in space
Keahiokalani 26 nov, 2024 @ 9:28 
"Added support for proximity sensors for warhead detonation. Missiles can now use a forward-facing camera or a sensor to assist in ensuring warhead detonation when nearing a target." Is this an editable value? I want to make an "airburst" style missile.
I have a follow on question if this is possible. Is it possible to trigger timers/event blocks with this function?
jTurp  [skapare] 20 nov, 2024 @ 14:19 
Thanks, I should be able to get to it by the weekend :)
Acid 19 nov, 2024 @ 21:40 
@jTurp
jTurp  [skapare] 17 nov, 2024 @ 2:54 
@Acid

Thanks :) and yes Hydrogen should work everywhere.
Acid 16 nov, 2024 @ 23:31 
The missiles can work on pertam
Acid 16 nov, 2024 @ 23:30 
I am using hydrogen powered missiles on a pertam, the missiles have a decently high TWR and decent hydrogen storage, I was making a patriot system, since I noted the scripts ability to intercept missiles, Ill drop a link to my world, the controls for the script are on the second Hotbar in the truck. At the moment im trying to get my world to publish lol
jTurp  [skapare] 16 nov, 2024 @ 17:36 
@Acid

Couple of things to think about:

1. Are you using the proper missile type for the atmosphere? ie are you trying to use ion missiles on a planet? If so, I stop the launch because they won't work. Same with Atmo in space.

2. If you're using Atmo in atmosphere, are you too high in the atmosphere? I do run a check for max potential thrust and if it's below a threshold I stop the launch for the same reason as #1

If neither of those are the issue, feel free to drop a link to your world and I'll give it a test :)