Is it possible to lerp a part like this?

So what I wanna do is I basically want to lerp a door to shrink it’s size down/up smoothly and not do anything with his position or rotation but ONLY his size so I can make a smooth door closing/opening animation.

But iirc lerp only uses CFrame right? which only uses position and rotation so how would I do this if it is even possible?

I am new to lerping so sorry if the answer is obvious.

1 Like

:Lerp is a method of Vector3’s. So yes you can linearly interpolate the size since it is a Vector3.

If you want you can also use TweenService instead, it might work better since the task is so simple

1 Like

Can you give me an example of how would this work?

Because I tried adjusting the size of the door smoothly by lerping it but it wouldn’t work.

Yes I agree.

TweenService is better for this and I know how to do it using TweenService but I think it’s also good to know how to do this using lerp too.

Just do part.Size:Lerp(goal, alpha)? I don’t understand what is the issue? Position and Size are both Vector3 values, and aren’t different that position can be interpolated but size can’t.

Where can we find documentation for Lerp? Can’t seem to find it on developer.roblox.com

1 Like

I say it is better only to use Tweens instead of lerp.

2 Likes

:Lerp just returns the value between 2 specified values (it also exists for CFrames and maybe some other classes). For example: (Vector3.new(0,0,0)):Lerp(Vector3.new(0,0,10),0.5) will return (0,0,5).

The math formula behind it is value0+(value1-value0)*increment.

1 Like

So I encountered a problem while trying to do what you said.

It works but the door doesn’t shrink it’s size down as intended.

Here’s what’s happening:

And here’s what I want it to do:

Does anyone have any solution for this? I have used Vector3.new(part’s size value that I want it to get to).

Simply use a tween where the size needs to be Vector3.new(value,value,value)?

2 Likes

Tween/lerp the position the same time as you are tweening the size, that way, it’ll look like it’s moving in, or you can simply just tween the position to go inside the wall and hide it there :man_shrugging:
@Nerkonl

1 Like

Thank you, the solution was to lerp the position and the size of the door at the same time!

Lerp isn’t resizing, it simpy gives a Vector3 from this operation:

value0+(value1-value0)*increment

Tween is better at resizing.

2 Likes