== Gunnanmon's Advanced Missile Expression ==
[ame="http://www.youtube.com/watch?v=8GuJDiRmCqA"]YouTube - Gunnanmon's Advanced Missile (Gmod)[/ame]
[ame="http://www.youtube.com/watch?v=dhlSV6un80o"]YouTube - Gunnanmon's Advanced Missile: Maneuvering Demo[/ame]

By utilizing target velocity, I've created an
advanced guided missile which predicts straight
line target trajectories in real time,
effectively cutting all corners where possible.
By also calculating the inertia of the missile
itself, interception accuracy, and reaction time
have been greatly enhanced while also eliminating
target orbit.
Basically, instead of the missile heading for its
target, it will fly ahead of it in a straight
line, so as to collide with it; this is called
'lead collision'.
The contraption itself is a simple missile I
threw together to demonstrate what the expression
is capable of; the missile is fully functional
however, and extremely hard to avoid.
How to Install:
If you would like to use the expression on your own missile,
all that's needed is a vector thruster and a target finder.
Ensure that the vector thruster is above the center point of the missile.
You are welcome to use and modify my expression, but
please give credit where due.
Code:
@name Gunnanmon's Advanced Missile Expression
@inputs Target:entity
@outputs Det Hold Vec:vector Mult
#@outputs HoloTest:vector, TP:vector
@persist GPS:vector
@persist Dist Tvel Gvel
@persist LM IM LV:vector GV:vector
interval(75)
LM = 0.00000075 #Lead Angle Modifier
IM = 0.00005 #Inertia Correction Modifier
if (Target)
{
Hold = 1
GPS = entity():pos()
Dist = Target:massCenter():distance(GPS)
if (Dist < 100) {Det = 1}
Tvel = Target:vel():length() * LM
Gvel = entity():vel():length() * IM
LV = (Target:vel() * Tvel) * Dist
GV = entity():vel() * Gvel
Vec = GPS -(Target:massCenter() + LV - GV)
#TP = Target:massCenter()
#HoloTest = vec(-((TP:x()+LV:x())-GV:x()), (TP:y()+LV:y())-GV:y(), ((TP:z()+LV:z())-GV:z())-150)
Mult = 1
}
else {Mult = 0, Hold = 0} Thanks to Hitman271 for cleaning up some of my code.
Bookmarks