How Can I Make This Car Rotate Properly With or Without Merging Meshes(Three.js)?

The problem that I have here is that I’m trying to make a car game here but the problem is that as you can see the wheel’s are rotating but not along with the car, here is the code I have in my car.js file:


export function createCar(x, y, z, color) {
  const geometry = new THREE.BoxGeometry(0, 0, 0);
  const material = new THREE.MeshBasicMaterial();
  const carCenter = new THREE.Mesh(geometry, material);
  carCenter.position.set(x + 2.5, y, z + 1.25)
  let objects = [carCenter];

  function createWheel(x, y, z) {
    createTorus(0.5, 0.25, "#36353a", x, y, z);
    createTorus(0.25, 0.25, "gray", x, y, z);
  }

  function createBody() {
    createRectangle(5.5, 3, 1, color, x + 2.5, y + 1, z + 1.25);
    createRectangle(2.5, 3, 1, "#e1ebe3", x + 1.75, y + 2, z + 1.25)
  }
  
  function createTorus(radius, innerRadius, color, x, y, z) {
    const geometry = new THREE.TorusGeometry(radius, innerRadius, 16, 100);
    const material = new THREE.MeshLambertMaterial({ color: color });
    const torus = new THREE.Mesh(geometry, material);
    torus.position.set(x, y, z);
    
    objects.push(torus);
    return torus;
  }

  function createRectangle(length, width, height, color, x, y, z) {
    const geometry = new THREE.BoxGeometry(length, height, width);
    const material = new THREE.MeshLambertMaterial({ color: color });
    const rect = new THREE.Mesh(geometry, material);
    rect.position.set(x, y, z);
    
    objects.push(rect);
    return rect;
  }

  function createCylinder(radius, height, color, x, y, z) {
    const geometry = new THREE.CylinderGeometry(radius, radius, height, 32);
    const material = new THREE.MeshLambertMaterial({color: color});
    const cylinder = new THREE.Mesh(geometry, material);
    cylinder.position.set(x, y, z);
    
    objects.push(cylinder);
    return cylinder
  }

  createWheel(x, y, z);
  createWheel(x + 5, y, z);
  createWheel(x, y, z + 2.5);
  createWheel(x + 5, y, z + 2.5);
  createBody();

  function turnRight() {
    objects.forEach(part => {
      part.rotation.y += 0.1;
    })
  }
  
  return {
    objects,
    turnRight,
  }
}

I don’t care if it uses sin or cosine or combining meshes(which I couldn’t find a method that would work). I tried for hours and still couldn’t find an answer for how to make the wheels kind of swing along with the corner of the car. I also tried to find a way to get the position in the corner of a box so I could set the wheel position to that. Is there another way to do it