I’m trying to make a lerp where it will go toward the player’s look vector and go up then down. How can I achieve this?
Thanks in advance.
Please, you only need to make one post for one topic.
1 Like
Last time you did NOT respond I’ve been waiting patiently and got no response. Although I agree with you.
1 Like
You can use bezier curves to achieve this.
Example code that will move a part through a quadratic bezier curve:
-- function from article page lol
function quadBezier(t, p0, p1, p2)
return (1 - t)^2 * p0 + 2 * (1 - t) * t * p1 + t^2 * p2
end
local p0 = workspace.p0.Position
local p1 = workspace.p1.Position
local p2 = workspace.p2.Position
local part = Instance.new("Part")
part.Size = Vector3.new(1, 1, 1)
part.Position = p0
part.Anchored = true
part.CanCollide = false
part.Parent = workspace
for t = 0, 1, .1 do -- do a for loop from 0 to 1
part.Position = quadBezier(t, p0, p1, p2) -- call the quadratic bezier curve function and place the new part
game:GetService("RunService").Heartbeat:Wait() -- wait a bit
end
5 Likes