I’m currently trying to achieve the path shown below
Basically a round CFrame that jumps to the air towards a certain point, i’m using this for an attack in my game.
I’ve tried many methods, such as math.sin and loops but those didn’t work
Please share the formula for these CFrame points or a module that is able to do this
You can accomplish this by using bezier curves. I know that a module exists for this, but I have no idea what it is called, you should be able to find it easily by just googling.
Ended up figuring it out with sleitnick’s Bèzier curve module, it’s really great.
Made a mini-code snippet for people like me who had no clue what Bèzier curve works like.
This was the code i made to preview like i did in this gif:
while true do
local curve = bezier.new(workspace.A.Position,workspace.B.Position,workspace.C.Position)
-- Duplicate the "B" point Y axis by 2 if you want it to follow the exact height of the part,
-- as you can see in the gif, it follows it partially.
local path = curve:GetPath(.075) -- has to be a number from 0 to 1,
-- the lower the number, the more path points there'll be.
--visualize thing
for i,oldPoint in pairs(workspace.PathPointsFolder:GetChildren()) do--remove old visualized pathpoints
oldPoint:Destroy()
end
for i,v in pairs(path) do--make new visualized pathpoints
local newPoint = game.ReplicatedStorage.PathPart:Clone()
newPoint.Parent = workspace.PathPointsFolder
newPoint.Position = v
newPoint.Name = tostring(i)
end
wait()
end