I wanted to try adding Magnus Effect to a ball when I shoot it (It means the ball curves like in football/soccer).
Here's a reference to what I'm talking about
Here's what I did (It's a function for a ModuleScript) Note that this is not the whole script, I removed some unnecessary things from the script that you don't need to see
function module.magnuseffect(b) --b refers to the Ball
local limb = RL --RL refers to Right Leg
local arm = RA --RA refers to Right Arm
local mag = ((b.Position - arm.Position).Magnitude)-((b.Position -
limb.Position).Magnitude) --Calculates the difference between the Magnitudes
local curlnone = (function()
-- No curve applies to ball
end)
local curlright = (function()
-- Ball curves to the right
end)
local curlleft = (function()
-- Ball curves to the left
end)
if mag < 1.5 then
curlright()
elseif mag > 2.35 then
curlleft()
else
curlnone()
end
end
The problem is that it is not actually as accurate because when you are too far back behind the ball sometimes It won't curve even though it didn't hit the middle part of the ball (Because it checks the Magnitude of the distance between the ball and the Arm)
Is there a better solution for this? Thank you.
