So, I’m using a bezier lerp function, and at the end half of the basketball is stuck in the part, Im not sure how to fix this i had a few ideas but they didnt work.
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr,finish) --Mouse.hit.p
Tool.Parent = workspace.RandmToolsInTheMap
local magnitude = (Tool.Handle.Position-finish).Magnitude
local origin = Tool.Handle.Position
local breakVal = false;
Tool.Handle.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
breakVal = true
Tool.Handle.Anchored = false
end
end)
finish += Vector3.new(magnitude/30*math.random(1,5)/10,magnitude/30*math.random(1,5)/10,0) --+Vector3.new(Tool.Handle.Position.Unit/2);
local middle = (finish-Start) + Vector3.new(0,12.5,0)
Tool.Handle.Anchored = true
for i = 1,100 do
RunService.Heartbeat:wait()
local te = i/100
if breakVal or i == 98 then
break
end
Tool.Handle.Position = quadBezier(origin,middle,finish,te)
end
Tool.Handle.Anchored = false
local m = -quadBezier(origin,middle,finish,100).Unit*80
m+=Vector3.new(0,m.Y*-2,0)
Tool.Handle.AssemblyLinearVelocity = m
end)
I just need to alter the Finish Position so half of it isnt stuck in the wall, just not sure how, something to do with the size of the ball and dividing it but still nothing.