#Global Hooks 

$GameInit: [ 
HorVelFn = function(x, z)
--calculates the resultant horizontal velocity along a 2d plane
xVel = x
zVel = z

rVel = math.sqrt(math.pow(xVel, 2) + math.pow(zVel, 2))

return rVel
end

]


$Simulation: [
if mn.getMissionFilename() == "Act2M3 - Aesir Approach" then
for u = 1, #mn.Ships do
   objectShip = mn.Ships[u]
   stringShipName = objectShip.Name
   if stringShipName == "Beta 3" then
	vectorGravity = objectShip.Physics.Velocity
	
	horVel = HorVelFn(vectorGravity[1], vectorGravity[3])

	--forVel = math.abs(objectShip.Physics:getForwardSpeed())
	vectorGravity[2] = vectorGravity[2] - math.min((10+0.05*math.abs(vectorGravity[2]))/((0.25*horVel)+1), 150)
	objectShip.Physics.Velocity = vectorGravity


   end
end
end
]
#End