Hey everyone, I’ve been thinking about the question in the title for a while now, I’m making a game that has a lot of doors that open/close smoothly, and I was wondering what was better for my game performance-wise.
The first option is Lerping. I already have code written for this. I achieve this by having 2 invisible doors, and having a visible door Lerp back and fourth between them. This option seems to work best visual, but I’m not sure how it will impact performance on older devices when multiple doors are in use.
The second option is Tweening. I don’t have any code for this yet, as I have been using Lerping for now. I heard that having multiple Tweens running will cause a big performance drop for the duration of the Tween, that is the main reason of this post is to figure that out.
TL:DR What is better performance-wise? Lerping or Tweening?
Performance wise, there is practically no difference between :Lerp()ing and :Tween()ing. TweenService runs on Linear Interpolation, but is simplified to make it easier.
What you should keep in mind, thought, is if the door’s open effects are mainly for the visual aesthetic, then you should perform the Tweening/Lerping on the client. This way, each individual client can handle it’s own doors, and you won’t have the same lag issue as if the server was trying to handle everything.
In short to answer your question, there is negligible difference between CFrame:Lerp() and Tweening, in terms of performance and difference in lag.
6 Likes
Thank you for your reply!
Considering there is no performance issues, I think I’ll go with Lerping still. I already am running on client, but thanks for the suggestion!
1 Like
Why don’t you just use a HingeConstraint?
Hey,
Unfortunately, my “door” is just meant to slide open, so in this case, a HingeConstraint wouldn’t work.
Thanks though!
1 Like