Hello. I am trying to make a custom cart for my cart ride game, with the wheels as hinge constraints that rotate to keep it moving. On straight tracks, both uphill and downhill it works perfectly but when it meets a
curved track it derails. How can I fix this? Thanks in advance
Like I said in your other post (Creating a cart that can go uphill and is more stable) you HAVE to have something like wheels or Parts underneath the rails that keep the cart on the track, and have something in between the rails so that the cart stays centered.
All of those items were in the model I included in that post. You can simplify my model a lot since it’s more complex than you need, but if you learn about Collision Filtering | Roblox Creator Documentation you can easily make wheels under the tracks that only collide with the tracks.
Hi, so something like this? Should I set the stiffness of the spring to be very high?
And do I just need a cylinder between the wheels and in the tracks to keep the cart centered, using a weld constraint?
Just like in the example place I keep telling you to look at, put a single “centering” Cylinder (wheel) between the rails where each of the main axles are.
Make them slightly narrower than the rails, and attach each one to the body with a HingeConstraint with the axle vertical.
These wheels keep the main axles centered on the rails.
You only need 1 cylinder below the rails, below the center of the cart body to keep the cart from derailing.
Use Collision Groups to make the bottom cylinder and the “centering” cylinders only collide with the rails, and nothing else. That way the cart stays on the rails and no matter what’s under or between the rails (like baseplates, Terrain, or rail ties) they won’t collide with them.
Do you have a PrismaticConstraint attached to the bottom wheel, or just the springs?
The prismatic would keep the ‘underneath’ wheel from sliding around, and it would only need 1 spring.
And are the actual cart wheels Unions or Meshparts? If they are then I guarantee they aren’t perfectly round.
You can research any of these items using the Search tool at create.roblox.com to find details and instructions. Or just use the search tool in these forums.
So how would I implement the prismatic constraint into the bottom wheel? I am currently unsure on what to attach the prismatic constraint to, and what to set it to.