Utility function for estimating low and high arcs of projectiles. Solves for bullet drop given. Returns two possible paths from origin to target where the magnitude of the initial velocity is initialVelocity.
npm install @quenty/trajectory --save
local bullet = Instance.new("Part", workspace)
bullet.Position = Vector3.new(0, 100, 0)
-- 200 studs down-range
local target = Vector3.new(200, 100, 0)
-- Use the actual function
local low, high, fallback = trajectory(bullet.Position, target, 250, workspace.Gravity)
-- Make part follow low trajectory if available, and then high, and then the fallback.
-- This will ensure the part, assuming it does not hit anything, hits the targetted position
bullet.Velocity = low or high or fallback
Returns two possible paths from origin to target where the magnitude of the initial velocity is initialVelocity
- origin: Vector3, Origin of the bullet
- target: Vector3, Target for the bullet
- initialVelocity: number, Magnitude of the initial velocity
- gravityForce: number, Force of the gravity
Determines the starting velocity to minimize the velocity at the target for a parabula
NOTE: This may only works for a minimizeEntranceVelocity
NOTE: This may only works for a minimizeEntranceVelocity