MF_StaticBallistics
Methods to compute various ballistic functions. These aren’t used in MobFarm Basics, but are used in other packages.
Public Class MFball
Static Methods
BallisticAimAngle : float? ( targetLoc : Vector3, exitLoc : Vector3, shotSpeed : float, arc : MFnum.ArcType )
Computes the angle to aim in radians to hit a target. Since nearly every solution will have two possible arcs, arc designates whether to find the lower or higher arc.
BallisticFlightTime : float? ( targetLoc : Vector3, exitLoc : Vector3, shotSpeed : float, aimRad : float, arc : MFnum.ArcType )
Calculates the flight time of a shot fired at aimRad radians. Internally, the formula uses the height difference between targetLoc and exitLoc, and to hit a given height, there are two solutions. arc will be used to determine the correct solution to use.
BallisticIteration : float? ( targetLoc : Vector3, exitLoc : Vector3, shotSpeed : float, aimRad : float, arc : MFnum.ArcType, targetVelocity : Vector3, platformVelocity : Vector3, aimLoc_In : Vector3, out aimLoc_Out : Vector3 )
When using both ballistics and intercept to hit a target, an iterative solution is needed.
This finds the angle to aim in radians to hit a target, then finds the intercept solution based on the time of flight. Then recalculates the aim angle with the new effective shot speed based on flight time.
Both aimLoc_In and aimLoc_Out are used to incrementally get closer to an acceptable solution with every iteration.
Methods to compute various ballistic functions. These aren’t used in MobFarm Basics, but are used in other packages.
Public Class MFball
Static Methods
BallisticAimAngle : float? ( targetLoc : Vector3, exitLoc : Vector3, shotSpeed : float, arc : MFnum.ArcType )
Computes the angle to aim in radians to hit a target. Since nearly every solution will have two possible arcs, arc designates whether to find the lower or higher arc.
BallisticFlightTime : float? ( targetLoc : Vector3, exitLoc : Vector3, shotSpeed : float, aimRad : float, arc : MFnum.ArcType )
Calculates the flight time of a shot fired at aimRad radians. Internally, the formula uses the height difference between targetLoc and exitLoc, and to hit a given height, there are two solutions. arc will be used to determine the correct solution to use.
BallisticIteration : float? ( targetLoc : Vector3, exitLoc : Vector3, shotSpeed : float, aimRad : float, arc : MFnum.ArcType, targetVelocity : Vector3, platformVelocity : Vector3, aimLoc_In : Vector3, out aimLoc_Out : Vector3 )
When using both ballistics and intercept to hit a target, an iterative solution is needed.
This finds the angle to aim in radians to hit a target, then finds the intercept solution based on the time of flight. Then recalculates the aim angle with the new effective shot speed based on flight time.
Both aimLoc_In and aimLoc_Out are used to incrementally get closer to an acceptable solution with every iteration.