export const animateWheels = (wheelRefs, rotation) => {
  if (!wheelRefs || wheelRefs.length === 0) return

  wheelRefs.forEach((wheelRef, index) => {
    if (wheelRef.current) {
      // Y-axis is the axle for these wheel meshes.
      // Odd indices (1, 3) are left side wheels; even indices (0, 2) are right side wheels.
      // Since left-side wheel groups are rotated 180 degrees in GLTF to face outward,
      // we invert the spin direction for one side so they all roll forward together.
      const direction = (index % 2 === 0) ? 1 : -1
      wheelRef.current.rotation.y = rotation * direction
    }
  })
}
