Hi everyone, I’ve currently been considering using CFrame for a driveable train chassis as it’s a more reliable option than something like body velocity or constraints from what I’ve seen / tested (derailments wise)
I was looking to see if anyone had any ideas about how to make something like this, I was originally thinking a node based system, but I was wondering if there was another method which didn’t require nodes in itself, and followed the actual track. I’ve had a go by making a basic accelerating / decelerating train but it only works on straight lines atm. Any ideas?
One of the issues with CFrame trains is you need to weld players to the cars using a script.
I’ve made a test model in another post that works pretty well. With some minor mods it will run well using two axle bogeys and on tracks that climb or descend as well.
If you’d like I could post a copy here later tonight.
Would appreciate a copy to see how it works and modify from there. Thanks for the advice about needing to weld players to the cars aswell, should be able to manage using some form of raycasting
Incase anyone was wondering, I decided to use a standard train bodyvelocity system, and CFrame to the ‘root’ of the train which handled the rest of the parts. Works really nicely
Sorry, I wasn’t able to get my version working well, it would run fine for a while but seemed to slow down even though I was adding more and more force.
Haha, you got me trying to figure out why it wasn’t working. I did some refining and now you have the option of running it with HingeConstraint wheels, or VectorForces pushing the train along. The script in the VehicleSeat is kind of rough, but I put explanations in it so you can switch if from wheel driven to VectorForce driven and back to see how each one works for you.
Seems to be running pretty well up to about 300 studs/second!!! It may derail around that speed though.
I used switches with CollisionGroups to be able to change from one track to another. Just click on the blue switch while playing to change tracks. (I think I had the wrong print output for ‘main’ and ‘siding’ though…)
If the player jumps off the seat the forces or hinges are reduced to 0 so the train coasts to a stop.