Hello, Developers!
I’m not exactly sure if this is possible. I’ve looked all over and haven’t found any solutions, nor have I been able to come up with something myself.
Essentially, I have a bezier curve for a ball. When a player clicks a certain position on an invisible wall, the position they click is the ending point on the bezier curve. What I want is for the bezier curve to end up a few studs past it, but I want the ball to still pass through the point that was clicked on it’s way to the ending position. I really hope that makes sense. Hopefully the picture below helps with visualization.
Excuse my poorly drawn curve, but the red dot is where the player would click (and the curve would have to go through), while the blue dot would be the ending point, a few studs past it.
function lerp(a, b, t)
return a + (b - a) * t
end
function quadraticBezier(a, b, c, t)
local point1 = lerp(a, b, t)
local point2 = lerp(b, c, t)
local calculatedPoint = lerp(point1, point2, t)
return calculatedPoint
end
Obviously, here’s your typical bezier curve functions. I set the ball’s position with it. The actual setting of the curve isn’t the issue, I just wanna be able to set different curves a few studs past where the player clicks.
Any help is appreciated. Thanks!