⇐ Index
⇐ Math Utility
BallisticArcLateral(<-from <-lateralSpeed <-target <-maxHeight) ->travelTime ->gravity ->fireVelocity
Solve the firing arc with a fixed lateral speed. Vertical speed and gravity varies. This enables a visually pleasing arc. Not every combination of inputs has a computable output. In the case the ballistic arc does not have a solution, zeros are returned for all values.
- from: Vector point projectile will fire from
- lateralSpeed: scalar speed of projectile along XZ plane
- target: Vector point projectile is trying to hit
- maxHeight: the world height for the projectile to peak at. When testing with a ground based unit, this needed to be higher than the unit position.
Returns:
- fireVelocity: Vector firing velocity
- gravity: gravity necessary to projectile to hit precisely max_height
- travelTime: The time it takes the projective to reach to target.
This API synergizes with the BallisticArcPos API which is a MoveTowards type of API but for arcs rather than a straight line which can use the returned variables to enact a smooth and visually appealing parabolic motion for a custom unit.
BallisticArcLateral(V3(10 1 10) 0.5 V3(50 5 40) 30) ->travelTime ->gravity ->fireVel
⇐ Index