Tank movment(waypoint)

Hi,

I want to move a tank by waypoints.how is the code?i created the tank and assigned it colliders and wheel colliders.but i have problem in script.specially when i want rotate the tank when it has arrived to a waypoint and need a rotation.

So thanks.

Do you need the tank to have realistic physics or do you just want it to roll up to a waypoint, turn to face the next one and then start moving again?

So thanks for respond.

I need realistic physic.i am working on it for 2 days.but i have problem yet.i did not find any tutorials,… for tank movment.
can you guide me exactly?
i don’t know what must i do.should i use wheel colliders?which functions is better for movement and rotation?
i need it.so thansk.

Have it get the rotation to the current waypoint, if the rotation to the waypoint is greater then 90* then turn if not, then start moveing forward wile turning. Should give you a nice tanklike movement.

Look at Unity - Scripting API: Quaternion

Here a function I use for turning a object to face something. (only on its Y axis)

    public void Face(Vector3 faceThis, float faceSpeed)
    {
        Quaternion targetRotation = Quaternion.LookRotation(faceThis - transform.position);
        targetRotation.z = 0;
        targetRotation.x = 0;
        transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, Mathf.Min(faceSpeed * Time.deltaTime, 1));
    }

If you want it physics driven change stuff to ridgidbody torc and addforce, its all in the unity docs.

How is the physic setup?