User Tools

Site Tools


modding:function:syscalcfiresolution

Discuss this page on this pag's Talk Page

sysCalcFireSolution

See sysCalcFireSolution at Xelerus

Syntax (sysCalcFireSolution targetPos targetVel speed) → angle or nil
Arguments targetPos: the vector position of the target
targetVel: the vector velocity of the target
speed: the speed of the projectile
Returns angle or nil
Category math, weapon
Description A very useful function when using sysCreateWeaponFire.

Automatically performs all trigonometry required to properly lead a target (assuming it moves in a straight line at constant speed)

Example

(sysCalcFireSolution (objGetpos aTargetobj) (objGetVel aTargetObj) (objGetVel gPlayerShip))

Will return the correct angle to fire a projectile in order to hit aTargetObj

Return to Functions list

modding/function/syscalcfiresolution.txt · Last modified: 2014/12/27 04:40 by 127.0.0.1