hello, how to do to move one object after another at a distance, and to make it easier for me to share it between the tractor and trailer, it’s about the script as a push button that engages in and as I press again splits off. thanks all.
You could use a Hinge Joint. A hinge joint connects two Rigidbodies, and would seem to work well for a tractor and trailer which are directly connected.
However, a Spring Joint might work for two Rigidbodies connected at a distance. A spring joint allows you to specify a min and max distance. This would allow the tractor and trailer to come together gradually when you press the button.
To disable a joint, I believe you can just remove the joint’s connected body by calling hingeJoint.connectedBody = null;
You can read about all the types of joints and other physics components here.
Check out some ‘snake’ type tutorials on youtube (or just google it). I found this one right away and I’m sure there are more out there.
You’ll probably have to work it through parenting/unparenting. Check out the unity docs for more information.