Jump to content




[ICBM] missile parth prediction Math probblem ?


6 replies to this topic

#1 BigSHinyToys

  • Members
  • 1,001 posts

Posted 07 November 2012 - 12:30 AM

http://pastebin.com/YigPX1A3

So something is wrong with gravity the X Y is fine but Z is a pain.

usage place a radar on top of a computer ant run this program. If you have problems with power low error then run the radar from batteries not directly from generators.

any help would be useful.

Thanks in advance

#2 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 07 November 2012 - 01:36 AM

You have very few comments in your code, so it takes me a while to figure out what you're doing. :P/> If you're thinking about actually predicting the trajectory.. I decompiled ICBM last week to look into that. The code was mostly in Japanese >.< but I came to the conclusion that the 'parabola' isn't physically correct. I also read a post from the author once, kinda saying the same thing. Also, wouldn't you need velocity and starting angle to calculate the trajectory as well?

#3 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 07 November 2012 - 04:48 AM

View PostOrwell, on 07 November 2012 - 01:36 AM, said:

You have very few comments in your code, so it takes me a while to figure out what you're doing. :P/> If you're thinking about actually predicting the trajectory.. I decompiled ICBM last week to look into that. The code was mostly in Japanese >.< but I came to the conclusion that the 'parabola' isn't physically correct. I also read a post from the author once, kinda saying the same thing. Also, wouldn't you need velocity and starting angle to calculate the trajectory as well?

how is java Japanese o.O

#4 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 07 November 2012 - 07:21 AM

View PostKolpa, on 07 November 2012 - 04:48 AM, said:

View PostOrwell, on 07 November 2012 - 01:36 AM, said:

You have very few comments in your code, so it takes me a while to figure out what you're doing. :P/> If you're thinking about actually predicting the trajectory.. I decompiled ICBM last week to look into that. The code was mostly in Japanese >.< but I came to the conclusion that the 'parabola' isn't physically correct. I also read a post from the author once, kinda saying the same thing. Also, wouldn't you need velocity and starting angle to calculate the trajectory as well?

how is java Japanese o.O
Not sure if he means the comment or if there is a Japanese version of Java, or maybe the code is impossible to read so he uses that as a metaphor.

#5 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 07 November 2012 - 07:38 AM

Just use a constant X and Y velocity, and for Z, you will do something like this:

g is in this case 9.8
velZ = velZ + g * 0.16 -- 0.16 is equal to about 60 FPS 

Then, to find the rotation of the object, you would do this:
local _x = lastX - x
local _y = lastY - y
local len = math.sqrt(_x ^ 2 + _y ^ 2)
rotation = math.acos(_x / len)

if y < lastY then
	rotation = 2 * math.pi - rotation
end

radians = 2 * pi - rotation
rotation = math.deg(radians) -- get rotation in degrees

lastX, lastY = x, y
You would apply this to x/z as well, and so on...

To apply all of this to the current game state, do this:
x = x + velX
y = y + velY
z = z + velZ


#6 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 07 November 2012 - 08:31 AM

The author of ICBM deliberately uses words in a language other than English in order to confuse people decompiling it - as he had been bitten by people stealing code before.

#7 BigSHinyToys

  • Members
  • 1,001 posts

Posted 07 November 2012 - 11:05 AM

I did some testing on the flight path the rate of change over time on the X and Y is a constant so i gain that by averaging the difference between data points in the set. my problem is following the curve current accuracy is about 400 meters.data recorded from a real ICBM launch using Computer craft.
Posted Image
data set
Spoiler
as for code commenting sorry I'm used to working on my own and have a near photographic memory here is commented ver.
http://pastebin.com/Wkc9mcJR





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users