4 Wheeled Farm Wagon Steering?


I want a wagon with 4 wheels where the hitch will follow the truck and cause the wagon to turn it’s front wheels pivot point as shown in the picture.

I couldn’t find such a wagon so I’m trying to build one myself, but I don’t know how to accomplish this. Maybe some hinges? The trailer should follow the truck realistically as it would in the real world, whether the truck is moving backward or forward. Any ideas? Thanks!

Try finding the vector between the hitch bulb and the wagon hitch pivot. As well find the rest distance length of that distance between ball and hitch pivot and in your update keep that constant. The derived vector would be used to set the steering rotation of the front wagon wheels. It seems to me that if you updated these two values …keep the distance constant and change the vector of the steering algo then it should reasonably simulate how it works without messing with joints etc.

I understand about 1/3 of what you said, sorry. So through googling, here’s my first attempt at the script:

    public Transform wagonJoint;
    public Transform ballHitch;
    public GameObject frontWheelLeft;
    public GameObject frontWheelRight;

    void Update()
    {
        //find the angle between the ball hitch and wagon pivot joint
        Vector3 wagonDir = wagonJoint.position - ballHitch.position;
        float angle = Vector3.Angle(wagonDir, transform.forward);
        frontWheelLeft.transform.eulerAngles = new Vector3(0,angle+90,0);
        frontWheelRight.transform.eulerAngles = new Vector3(0, angle+90, 0);

        //Rest Distance Length from ball hitch to wagon pivot joint
        float restDist = Vector3.Distance(wagonJoint.position, ballHitch.position);

        Debug.Log("wagonDir: " + wagonDir + "& angle = " + angle);
    }

and in play mode, the tires go offset in position as shown below, and when I move the tongue of the wagon, the tires rotate in the opposite direction they should be rotating, also shown below.


Inverse steering:

Also, I’m not sure once I get this steering figured out, how the wagon will actually respond to the direction of the front tires, or will just having rigidbody’s on them achieve that?

You will probably have to multiply one of your values for angles by -1. The rigidbodies should help with it as you guessed. This was not a solution I proposed .it was a method to find a solution by using a main mechanic I can shuffle numbers on to get a reasonable sim of the behavior I am attempting to fake. The wagon wheels should be pointing at the hitch. The hitch bar should always be attached to the tow bar ball and the wagon hitch pivot. Get that down first…then the wheels should easily follow.