Tweening doors on a tram that use physics

  1. What do you want to achieve? Hello, i am making a tram system by using a linear velocity. All my tram parts (including the doors) are welded to the tram primary part which contains the linear velocity and i want the doors of the train to be able to open when stopped at a station.

  2. What is the issue? I cannot find how to make the doors open and close without breaking the whole tram.

  3. What solutions have you tried so far? I tried multiple fixes, directly tweening the door even if welded, anchoring the train when stopped at a station and tweening the doors, i also tried prismatic constraints, but it seems that players can force the door to move by walking into it.

It sounds like you’re tweening the door model itself, which wouldn’t be relative to the tram as a whole. As you set the goal, your tram model will move so your model will too, bringing your tram doors back to position you set their goal to.

Try tweening the C0 property of the weld instead, this will slowly tween the welds offset which will keep your doors in a relative position to the tram.

I’m not sure how this will effect collisions of players due to the moving doors, however if this is still an issue a quick fix would be to stop the collision of doors as they’re tweened.

I would try to create animatable doors and create animations to open and close it.
Easy, peasy. :slight_smile:

Like by rigging the doors and putting a humanoid inside of them?

by using an animationcontroller

If these are sliding doors, consider physics constraints. I made a demo place that shows lots of ways to do this with very little scripting and just a single actuating constraint. It was a problem I had to solve in order to have multi-part doors open and close in sync. You have a lot of control over prismatic-based doors; you can also anchor them at the ends of their travel to prevent people forcing their way through.

This is the place, copy-unlocked and free to use for creations or inspiration:

2 Likes

Use a motor6D instead of weld for the doors, so they still are attached to the primary part but are still moveable with a tween on the motor.C0.

My doors have multiple parts, so, do i weld all of the door parts to the door primary part and use a motor6d for the door primary part to the tram primary?

Exactly yeah, that’s what you can do

I tried using a motor6d, i welded all the parts of my door to the primary part of the door and inserted a motor6d in the tram primary part, set the part0 of the motor6d to the tram primary part and the part0 to the door primary part, when i did that, the door went in the middle of tram and even if i set the original position of the door in C0 or C1, it’s still not in the good position as it was position

The postion of the motor is not a world position, it is a position relative to the primary part, so it is not the same values.

BTW, sorry haven’t read your issue fully, but a lot of popular transport games, like SCR, use Humanoids and Animators to do this, I experimented in the past and it’s a lot easier in the long run to use this method

I could be easier, but it is much more laggy and unaccurate due to how Roblox handle humanoids and animations.

Just wondering, did you tried to destroy the weld of door primary part, tween the primary part, and re-weld it to the tram primary part next?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.