Ad
Log in to vote
0

Can Lerps of a Part be printed?

Asked by 17 days ago
Edited 17 days ago

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

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 VAnkata20 135 — 17d
0
You can't. You can't get the lerp of a part. T3_MasterGamer 1002 — 17d
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? greatneil80 2641 — 17d

1 answer

Log in to vote
2
Answered by
imKirda 4428 Moderation Voter Community Moderator
17 days ago

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

0
i have aqquired 1 braincell thx MOJANGcreator091 45 — 15d
Ad

Answer this question