Skip to content

.solveStatic() Playcanvas

Alex edited this page Nov 14, 2021 · 3 revisions

Ballistics.solveStatic(from, target, speed, [gravity])

  • from (pc.Vec3) position from which the projectile is fired
  • target (pc.Vec3) position of the target that projectile is trying to hit
  • speed (number) projectile speed
  • gravity (number, optional) the current world gravity, defaults to project global settings
  • Returns 1 or 2 firing solutions, if found, otherwise null
{
     lowAngle: pc.Vec3(),
     highAngle: pc.Vec3()
}

Solve firing angles for a ballistic projectile with speed and gravity to hit a fixed position.