Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can Lerps of a Part be printed?

Idk im just curious if i can actually print it or not ? If it can be printed, how do you even do it?

3 comments

0

You are not able to i think. The only thing it returns is a cframe value but with a for loop you can kinda see the percentage increasing for the value of the loop but thats about it

0

You can't. You can't get the lerp of a part.

0

print(part1.CFrame:Lerp(part2.CFrame,.5).Position) wth are you guys talking about, ofc you can print the lerp, it returns a cframe and if you want to get the percentage you can do that as well with your own function using magnitude, am I not seeing something in this question which is why you guys are saying no?

1 answer

✓ Accepted answer

You can pretty much print everything here's an example of what you probably want:

local part = game.Workspace.Part

local start_cframe = CFrame.new(-5, 10, 0)
local end_cframe = CFrame.new(5, 10, 0)

for alpha = 0, 1, 0.1 do
    local lerped_cframe = start_cframe:Lerp(end_cframe, alpha)

    print()
    print("Alpha:", alpha)
    print("CFrame:", lerped_cframe)
    print("Position:", lerped_cframe.Position)
    print()

    part.CFrame = lerped_cframe

    task.wait()
end

Here's the output: (Alpha is the lerp percentage, 0 = 0%, 1 = 100%)

Alpha: 0 CFrame: -5, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: -5, 10, 0

Alpha: 0.1 CFrame: -4, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: -4, 10, 0

Alpha: 0.2 CFrame: -3, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: -3, 10, 0

Alpha: 0.30000000000000004 CFrame: -2, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: -2, 10, 0

Alpha: 0.4 CFrame: -1, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: -1, 10, 0

Alpha: 0.5 CFrame: 0, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: 0, 10, 0

Alpha: 0.6 CFrame: 1.00000012, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: 1.0000001192092896, 10, 0

Alpha: 0.7 CFrame: 2, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: 2, 10, 0

Alpha: 0.7999999999999999 CFrame: 3, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: 3, 10, 0

Alpha: 0.8999999999999999 CFrame: 4, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: 4, 10, 0

Alpha: 0.9999999999999999 CFrame: 5, 10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 Position: 5, 10, 0

1 comment

0

i have aqquired 1 braincell thx

This discussion is preserved as it was. New answers, comments, and votes are closed.