10 posts
Posted 14 April 2017 - 12:38 AM
So, I was playing around with the ICBM mod and the peripheral of the RADAR and the ICBM launcher, and I had a thought.
The missile takes a ballistic path (Well, not a realistic ballistic path, but it has its own rules and stuff that are constants), so.
Would it be possible to take the location of the missile, then do it a few more times over a few seconds, and find out the exact path that the missile is taking. Then work out the launch co ordinates from that final approach to its target.
The maths might not be as complicated as I think. 3D vectors, co ordinates. Trigonometry no doubt.
So. Anyone got any idea if someones done this before? Or if its even possible?
686 posts
Posted 14 April 2017 - 03:26 AM
I don't think so. IIRC they don't take an actual ballistic path. They just go up to a certain height then go straight until they reach a certain distance from their target then start going back down.
2427 posts
Location
UK
Posted 14 April 2017 - 11:11 AM
Given what D3matt has just said, I would observe some missiles in a test world to confirm what kind of path they take.
Or you could look at the
source code of the mod
If I'm right in my interpretation of the
source then D3matt is right, I could be wrong as learning Java and how to mod are both something I want to learn to do.
Edited on 14 April 2017 - 10:20 AM
10 posts
Posted 14 April 2017 - 01:28 PM
Ok. So i'm still looking into it. I know this is called a key/value pair. But what does it even mean. How do i get information from the RADAR?
686 posts
Posted 14 April 2017 - 01:35 PM
Ok. So i'm still looking into it. I know this is called a key/value pair. But what does it even mean. How do i get information from the RADAR?
That's a table of values. You reference it like this:
table[1]
table[2]
table[3]
I don't know the format of it so I recommend opening the lua console and playing around with it. It's probably just a table of x,y values but who knows.
Check this page out for some pretty straightforward examples of tables in lua:
https://www.lua.org/pil/2.5.html
Edited on 14 April 2017 - 11:36 AM
10 posts
Posted 14 April 2017 - 01:45 PM
Ok. Ill show you what I've done in the Lua console.
The ICBM wiki says this: "
Two methods are provided, getBlocks() for other radars and EMP towers and getEntities() for missiles, players and planes. Both return the contacts in the same format.
Returned data comes in a table with key / value pairs for the xyz coordinates of each detected object in range. Keys are formatted as follows: x1, y1, z1, x2, … zn where n is an arbitrary number distinguishing unique contacts."
2427 posts
Location
UK
Posted 14 April 2017 - 02:45 PM
try this in the lau prompt
radar = peripheral.wrap("right")
results = radar.getEntities()
for k,v in pairs (results) do print("results["..tostring(k).."] = "..tostring(v)") end
10 posts
Posted 14 April 2017 - 07:06 PM
Thanks Lupus590. Right. Now Its numbers and not letters so i might be able to work out how to do stuff.
EDIT
Ok after 15 mins of playing around with the code you gave me and I made a program called radar that tracks it real time. Im working on calculating the velocity of it right now.
Ok guys, thats me got V1.0 of the missile tracker.
Anyone have any suggestions as to how I could implement multiple target tracking?
Edited on 14 April 2017 - 06:24 PM