Teleporting vehicle based on wheelColliders

Hello. Quick question. How do I mimic moving object at pause in runtime?

Problem: I want to teleport vehicle with wheel colliders and the road but get unexpected behavior. When teleporting by using method via [ContextMenu(“”)], the vehicle goes flying or jumping or something else. But when I stop the game in editor and move selected root objects by hand, it behaves normal.

Did I get my coding wrong, or was it a problem with physics? If it is impossible to achieve desired behavior, then what alternative do I have?

Example for “manual” teleporting:
Teleport_Manual

Example for teleporting with code:
Teleport_Method

Code for teleporting:

    Vector3 offset = Vector3.zero;
    public Transform referenceObject;
    public List<GameObject> whatToTeleport = new List<GameObject>(); // road and vehicle root objects
    private void LateUpdate()
    {
        offset = referenceObject.position;
    }

    [ContextMenu("Move at start")]
    void Shift()
    {
        foreach (GameObject obj in whatToTeleport)
        {
            Vector3 newLoc = obj.transform.position - new Vector3(0, 0, offset.z);
            obj.transform.position = newLoc;
        }
    }

Do you have a rigid body in the hierarchy? To move a rigid body at runtime you need to set rigidbody.position, rigidbody.rotation, rigidbody.velocity and rigidbody.angularVelocity accordingly. Transform changes during runtime on a game object with a rigid body will either do nothing (transform callbacks are turned off) or will cause physics problems. Bear in mind all Rigidbody vectors are in world space and that any joint constraints or transform relationships will be ignored when changing these values, so you have to move every child rigid body as well. If you don’t, the joint constraint (depending on how you have it set up) may try to force the rigid bodies back into a valid state, usually resulting in some extreme velocities.

Thanks for the answer. I’ll try to rewrite the code according to your suggestions. Don’t expect a fast answer from me; I’m not intensely developing.

It seems Fixed Joints makes cars difficult to teleport. I added two vehicles with rigid bodies. But to first, i added a child with collider, rigid body and fixed joint, to second i added a child with just colliders. Additionally, added flat road (cube collider) with no bumps to rule out curvy road from testing. The second vehicle teleports kinda fine.
Using this code to teleport cars and road:

void Shift()
{
    foreach (GameObject obj in whatToTeleport)
    {
        Vector3 newLoc = Vector3.zero;
        if (obj.GetComponent<Rigidbody>() != null)
        {
            Rigidbody rb = obj.GetComponent<Rigidbody>();
            newLoc = rb.position - new Vector3(0, 0, offset.z);
            rb.position = newLoc;
            foreach (Rigidbody childrb in rb.GetComponentsInChildren<Rigidbody>())
            {
                newLoc = childrb.position - new Vector3(0, 0, offset.z);
                childrb.position = newLoc;
            }
            continue;
        }
        newLoc = obj.transform.position - new Vector3(0, 0, offset.z);
        obj.transform.position = newLoc;
    }
}

What happens:
Teleport_2Cars_test

What and how i need to change, except for the position of rigid bodies? Or it would be easier to not use fixed joints at all? (But i want to make it work with joints)

P.S Want to use fixed joints to transfer weight/mass and center of mass of vehicles parts to the parent rigid body (cabin, body, bumpers, crates etc)

I just removed fixed joints and rigid bodies from the children of the vehicle and will be remaking how the car works