Simulate a mooving wagon

there is a while since I try to simulate the movement of a train on rails.

I looking for a simple way to do it without physics if it’s possible.

this is how I see a train :

a train is composed of several wagon tied one to the other .

a wagon is composed of node 3 has a front ( frontWheelNode ) one at the back ( backWheelNode ) and another node ( wagonNode ) between the two node ( frontWheelNode and backWheelNode )

frontWheelNode backWheelNode and are controlled by a related motioncontrol on the path .

frontWheelNode and backWheelNode is a constant distance between the two.

wagonNode is placed between the two node but not on the path , look at it frontWheelNode .

A space is attached to wagonNode and represents the wagon.

frontWheelNode is attached to wagonNode
backWheelNode is attached to wagonNode
wagonNode is attached to the rootNode

q1 . Is it okay for you?

q2 . I do not want to use the physical because it seems complicated, do you think this is possible?

q3 . now i have a problem in order that the two nodes ( frontWheelNode and backWheelNode ) guides wagonNode (this node is the parent of the spatial of the wagon) , do you have advice to offer me ?

I saw TestAttachDriver actuelement because I can not run my car was fr but as I said if it’s possible I do not want to use physics.

I can paste code because i tried many thing and it is the mess but if you want i can past it.

If you dont need physics, dont use them, they only make things much more complex (and you could still set a kinematic body, so it pushes stuff away if necessary)

Basially assuming front and backwheel keep same distance(as they probably should)

calculate vector from back to front wheel.
backwheel + half way to front wheel = between both wheels.
set the wagons position there, use the lookat to tell it to look at the front wheel.

For this your wagon needs to be centerd in the middle, and forward in the model must be forward.

I’d also manually move the object along the track for a train instead of using the physics vehicle. If you still want it to push away other physics objects you can attach a kinematic physics control.

Thanks you Empire Phoenix and Normen.

it work fine :slight_smile: