(This is also one of my first posts on the devforum, if I am posting wrong please let me know)
Hello, I am currently trying to make a Bezier curve in studio. I have the scripting for the Bezier curve done, however I am currently struggling to make a limiter for how far the player can go with the curve.
For example, I want the player to go only 100 studs with this curve, but if they exceed 120, it will automatically shorten it to 100 studs. How can i do this?
Here is the beginning of my script that has the variables.
function SmackDown(HRP, MouseHit)
local PartThings = script.Parent:WaitForChild(“PartThings”)
local function Curve(t, P0, P1, P2)
local A = P0:Lerp(P1,t)
local B = P1:Lerp(P2,t)
return A:Lerp(B,t)
end
Hey there! This belongs in #help-and-feedback:scripting-support, bezier curves are tricky, but think of it as 3 points, starting point, height and then ending point, as seen as here.
these points are then put into a equation and it, usually height isn’t on the curve, unless the curve is flat, aka a line.
Thanks for showing me how to post and handle with bezier curves. Although it doesnt exactly answer my question, I did a little bit more digging and found an answer. Thank you again.
You could check the distance from the players character position to p1 (the end position). So if you were to make p1 the mouse.hit position, all you would do is find the distance in magnitude from the character to the mouse position and do a check to see if it’s over 100 studs.