local function PredictNextPosition(targetPosition, targetVelocity)
if targetPosition ~= nil and targetVelocity ~= nil then
local duration = 1
local gravity = workspace.Gravity
local targetPos = targetPosition + targetVelocity
local direction = targetPos - firePoint.WorldPosition
local height = gravity * duration * 0.5
local force = direction / duration + Vector3.new(0, height, 0)
local endPosition = targetPos * duration
return force, endPosition
end
end
You might need to multiply (or divide) it by math.pi if I’m not mistaken. I had to make an arc system before, but I used math.cos and not math.log (now I believe log is better).
After testing it, I think I fixed it. Here’s the updated function:
local function PredictNextPosition(targetPosition, targetVelocity)
if targetPosition ~= nil and targetVelocity ~= nil then
local targetPos = targetPosition + (targetVelocity*projectileDuration)
local direction = targetPos - part.Position
local height = gravity * projectileDuration * .5
local force = direction / projectileDuration + Vector3.new(0, height, 0)
local endPosition = targetPos * projectileDuration
return force, endPosition
end
end
You just forgot to multiply it by projectileDuration.