Integration Guide
Last updated
Last updated
Once you have a mesh ready, you need to re-import it with correct offsets
Your cart mesh has to have it's 0.0.0 center axis on the spot where the rotation hinge will be (the hinge through which it will be connected to the following cart or the locomotive) as it will be the origin of it's rotation as it moves alongthe rail tracks.
Additionally, you'd also want to attach this Hinge mesh attachment at the end of it to allow additional carts to be connected afterwards. You can find this mesh inside Content/Train/Meshes named as SM_CLAMP.
You can do this in your 3D editor or inside the prefab blueprint, it doesn't really matter as long as it's there.
Additionally, you will have to make a new Animation blueprint that has identical logic to ABP_CoalCart
You may be able to get away by using an ABP child instance if you rig your custom model under the same skeleton, otherwise you'll have to make a fresh copy and carry over the from the animgraph.
Find BP_CoalCart and Make an Child Instance Class, name it whatever you want, it will be your new custom cart.
Open up your new blueprint class. and replace the Skeletal Mesh with your new mesh
You will also have to swap out the ABP_CoalCart with your new ABP you made earlier.
Add this node setup on your BeginPlay, (this example has ABP_CoalCart, this is where you would cast to your new ABP instead) and set the speed to 0 to avoid any glitches.
You will also have to setup overrides for the ABP control functions. In this case you only need to Override Update ABP speed and Update ABP rot
Once again, setup the functions in this way (except use your new ABP instead of ABP_CoalCart cast node)
Now that your mesh and ABP references and functions are ready to go, you need to do the final tuning, find a rotation sweet spot for the Cart Length. Try to enter the closest value of the distance from the 0.0.0 point (hooking point) to the back of your cart in centimeters. (you may want to fiddle with the value a bit to get best looking results as it not 100% accurate)
Also if your wheel spinning animation speed looks out of sync from the train Locomotive animation speed , you may want to open the Animation asset itself and play with the Rate Scale variable until you get a better looking result.
And that's it. Now your cart is ready and you can drop the in the level and add them to the Locomotive cart chain just like the usual carts in the example.