Animating Objects Attached to a Moving Assembly

Hi, I’m currently looking for suggestions on the best method to animate an object that is attached to a moving assembly.
For example, I want to animate a train window opening and closing while the train is moving.

Here’s what I’ve considered so far:

  • Using TweenService → The problem with TweenService is that it tweens the object towards a fixed target CFrame. Since the train is moving, the target CFrame doesn’t update along with the train movement — causing the window to appear left behind or not following the train properly during the tween.
  • Using PrismaticConstraint → I’m concerned that this approach might consume a lot of physics resources, especially if there are many moving parts or animated objects on the train.
  • Using AnimationController → This method requires multiple animations (open action, open idle, close action), which can take a lot of time and effort to create. Additionally, animations sometimes do not load instantly, causing the object to appear frozen or stuck briefly when the animation plays for the first time.

Is there a recommended or efficient approach to handle this kind of animation?
I’m looking for a solution that is performance-friendly and visually smooth for objects attached to a moving assembly like a train.

Thank you in advance!

2 Likes

The Lerp() method of CFrame might help you with this

Regarding animationcontroller, do you mean that it’s a delay on a loaded animation when you play it? Otherwise the delay goes away if you load it much prior to playing it.
Personally I only use animationcontroller stuff for animations based on “dynamic” positions

you could use attachments or welds instead of parts when using tweenservice