Hello I am using the FastCast API to manage projectiles in my tool wrapper module and I wanted to ask how could I change the acceleration of the projectile depending on the distance from the position I aimed at to make it hit/destroy itself there (like in the picture) with a parabolic trajectory (like basketball)
This is the code I use for firing function (some parts are from the example gun):
-- Shortcuts
local pointerRaycastResult = inputData.RaycastResult
local projectile = self.Config.Projectile
-- Shortcuts
for i = 1, projectile.PerShot do
-- If the input raycast didn't hit anything (likely when there was no object in front of the raycast)
-- set the raycast hit position to farthest it could possibly go
local raycastHitPosition = if pointerRaycastResult then pointerRaycastResult.Position else inputData.FarthestRaycastPosition
-- Direction to the raycast hit position relative to tool's fire point position
local inputDirection = (raycastHitPosition - self.FirePoint.WorldPosition).Unit
local orientational = CFrame.fromOrientation(0, 0, Randomizer:NextNumber(0, Tau))
local directional = CFrame.new(Vector3.new(), inputDirection)
local angleSpread = CFrame.fromOrientation(math.rad(Randomizer:NextNumber(projectile.MinSpreadAngle, projectile.MaxSpreadAngle)), 0, 0)
local direction = (directional * orientational * angleSpread).LookVector
local distance = (self.FirePoint.WorldPosition - raycastHitPosition).Magnitude
local calculatedAcceleration = self.Config.Projectile.Acceleration
self.CastBehavior.Acceleration = calculatedAcceleration
local simBullet = self.Caster:Fire(self.FirePoint.WorldPosition, direction, (direction * projectile.Speed), self.CastBehavior)
end