So, I need help trying to calculate projectile motion:
The Module I am using for this:
local nextPosition = PredictProjectile:FindLeadShot(targetRoot.Position, targetRoot.AssemblyLinearVelocity, ToolData.BulletSpeed, characterRoot.Position, characterVelocity, ToolData.EffectGravity)
script.FireProjectile:Fire(firePoint, nextPosition)
FastCast:
castBehavior.Acceleration = Vector3.new(0, -ToolData.EffectGravity, 0)
script.Parent.FireProjectile.Event:Connect(function(firePoint, hitPosition)
castParams.FilterDescendantsInstances = {character, projectilesFolder}
local orgin = firePoint.WorldPosition
local direction = (hitPosition - orgin).Unit
caster:Fire(orgin, direction, ToolData.BulletSpeed, castBehavior)
end)
ToolData:
local module = {
BulletSpeed = 100,
Projectile = Projectiles:WaitForChild("Arrow"),
DebugMode = true,
EffectGravity = 200,
MaxDistance = 10000,
}
I want it to always hit the target.