Character moving whilst on moving objects

I’m trying to make the character stick to a moving train, however it doesn’t work. I’ve tried mutliple things, no idea if i’ve done it right tho. But I can’t seem to get it to work.

My goal is for the character to remain in the train without jittering and moving around as well as being able to walk through the train.

I’ve tried the following without success:

  • AlignPosition
  • PristmaticConstraint

For the movement I use LinearVelocity connected to an EnginePart on the train. All the parts in the train are welded.

It works fine when the train is stood still but when moving it starts going crazy

Any help is appriciated!

2 Likes

You could find the players position and move it keeping the same speed as the train by just incrementing the players position by the speed.

(e.g.): playerPos += Vector3.new(playerPosX + trainSpeed, 0, 0)

Was the train made using physics or just tweening? Physics instances like constraints and velocities allow the player’s movements, but may cause lag or delay if repeated within the game. Tweening is efficient too since it doesn’t use that much client memory and runs at the same speed even if away from the player.

Basically, there’s a difference in benchmarking.

I suggest watching a Suphi video about this, it may help.

Thank you very much, I will try and do something with that. Appriciate it

1 Like

I would check out this post:

3 Likes