How to make physics for rail trolley with gravity changing. Unity 2d game
Hey, guys!
I'm trying to make the game about rail trolley. It should move by rails automatically. The player can make jumps and change the gravity (so, the trolley can move under the rails). So, mechanic consists of 3 elements: moving, jumping and gravity change.
But I'm stuck and can't make the physics works really good.
How it should be:
The movement should be stable at almost the same speed
The rail trolley shouldn't fall down from the rails (only if the player couldn't make the jump to other rails)
The jump needs to be smooth and fast.
The problems:
The rail trolley is shaken often.
Sometimes it falls down from the rails when the speed is too high.
Can't create the right force for jumping.
What I've done already:
I've made box collider 2D for the rail trolley body and attached wheel joint 2d to the game object.
Created my custom gravity for the rail trolley via script.
Does anyone have some idea how to create the right physics for that game?