Couplers
Language: | [[::Couplers|English]] |
---|
Couplers
Added in version 0.6.0 , the couplers add the ability to attach two nodes together into one.
The first use of couplers within the game is as a way to attach trailers to a car or a truck.
How to use it for trailers
Using the couplers to attach a trailer is quite straight-forward.
Position your vehicle close to the trailer, and press "L". You will see the two coupler nodes become colored spheres and pull towards each other, bringing the trailer onto the hitch.
Couplers can also be attached or detached via radial menu :
Couplers in JBeam
This tutorial will show you how to create you own couplers.
First you need to define at least two nodes which you would like to use as couplers. For example, on one hand, a node of a vehicle's tow hitch, and on the other hand, a node of a trailer's hitch point.
Let's start!
Here is the nodes part of the pickup_towhitch.jbeam:
"nodes": [ ["id", "posX", "posY", "posZ"], {"collision":true} {"frictionCoef":0.5}, {"selfCollision":true} //--TOW HITCH-- {"nodeMaterial":"|NM_METAL"}, {"group":"pickup_towhitch"} {"nodeWeight":5}, ["tw", 0.0, 2.76, 0.58,{"couplerTag":"tow_hitch","couplerStrength":2001000,"couplerRadius":1}], ["tw2", 0.0, 2.76, 0.49], {"group":""} ],
And this is the corresponding node of the trailer from the tsfb.jbeam:
//tow ball end ["tsfb8", 0.0, 2.76, 0.59, {"tag":"tow_hitch","couplerStrength":201000,"importElectrics": ["lowhighbeam", "reverse", "signal_L", "signal_R"],"importInputs": ["brake", "parkingbrake"]}],
As you can see the nodes tw and tsfb8 are defined as coupler nodes.
Add these coupler identifiers with the curly braces to the nodes of your choice to make a good couple of nodes ;)
The most important thing is that the couplerTag coincides otherwise they will not attach. If the tags do not match, the coupler visuals within the game will have different colors (see the following picture).