fogón

← City3D assetfogon/forklift

Autoelevador

by fogonCC010289 blocks
AutoelevadorDrag to turn it
// «Autoelevador» · propio
// A yellow forklift truck with a black roll cage and seat, a counterweight at the back, four dark wheels, a steel mast at the front and two forks carrying a small pallet with a crate.

// A yellow forklift, its mast towards the front. The carriage (forks, pallet and crate) is its own part: it goes up and
// down the mast.
const YELLOW = { base: "#f2b61c", light: "#f9cf4e", dark: "#cc930d" };
const BLACK = "#1e1f22", DARK = "#2e3035", GREY = "#45484d", GREY_LIGHT = "#5a5e64";
const STEEL = { base: "#6e747b", light: "#8f959c", dark: "#4f545a", chrome: "#cdd2d8" };
const WOOD = { plank: ["#b9803f", "#c68d49"], groove: "#8a5a28", frame: "#9c6730", frameLight: "#b98040", frameDark: "#744a20", pale: "#d6bc8c", paleDark: "#b59a6b" };

// A wheel with its axle along x: a tire with tread and a yellow rim on the outer side.
function wheel(x0, x1, cy, r, outerX) {
  for (let x = x0; x <= x1; x++)
    for (let y = Math.floor(cy - r); y <= cy + r; y++)
      for (let z = 0; z <= 2 * r; z++) {
        const d = Math.hypot(y - cy, z - (r - 0.5));
        if (d > r) continue;
        const tread = Math.floor((Math.atan2(z - (r - 0.5), y - cy) + Math.PI) * 3) % 2 ? BLACK : DARK;
        set(x, y, z, d > r - 1.6 ? tread : x === outerX ? (d < 1.2 ? STEEL.dark : YELLOW.dark) : DARK);
      }
}

// The chassis, the cowl with the dashboard, the engine cover and the counterweight.
box(15, 20, 3, 32, 40, 11, YELLOW.base);
box(15, 20, 3, 32, 40, 3, DARK);
box(15, 20, 11, 32, 40, 11, YELLOW.light);
box(15, 30, 5, 15, 38, 5, YELLOW.dark); box(32, 30, 5, 32, 38, 5, YELLOW.dark);
box(16, 24, 11, 31, 28, 11, GREY); // the floor mat
box(15, 20, 12, 32, 23, 19, YELLOW.base);
box(15, 20, 19, 32, 23, 19, YELLOW.light);
box(18, 23, 14, 29, 23, 18, DARK);
set(20, 23, 17, "#d2452f"); set(22, 23, 17, "#58c46a"); set(27, 23, 16, STEEL.chrome);
box(12, 19, 10, 14, 31, 11, YELLOW.dark); // mudguards
box(33, 19, 10, 35, 31, 11, YELLOW.dark);
box(15, 29, 12, 32, 39, 17, YELLOW.base);
box(15, 29, 17, 32, 39, 17, YELLOW.light);
for (let y = 31; y <= 37; y += 2) for (const x of [15, 32]) box(x, y, 13, x, y, 15, DARK); // vents
for (let x = 15; x <= 32; x++)
  for (let y = 39; y <= 45; y++)
    for (let z = 3; z <= 19; z++) {
      const corner = y === 45 && (x === 15 || x === 32 || z === 19 || z === 3);
      if (corner) { set(x, y, z, null); continue; }
      set(x, y, z, z >= 18 ? GREY_LIGHT : rand() < 0.1 ? GREY_LIGHT : GREY);
    }
box(22, 45, 7, 25, 46, 8, DARK); // the tow pin
box(17, 45, 13, 18, 45, 14, "#d2452f"); box(29, 45, 13, 30, 45, 14, "#d2452f"); // tail lights

// The seat and the steering wheel.
box(19, 29, 18, 28, 34, 19, BLACK);
box(19, 35, 18, 28, 36, 27, BLACK);
box(20, 35, 20, 27, 35, 26, DARK);
line(23, 24, 19, 23, 26, 22, 0, DARK);
line(24, 24, 19, 24, 26, 22, 0, DARK);
box(21, 26, 23, 26, 28, 23, BLACK);
set(23, 27, 23, null); set(24, 27, 23, null);

// The roll cage: four posts and a roof of bars, a beacon and two headlights.
for (const x of [15, 31]) {
  box(x, 20, 20, x + 1, 21, 35, BLACK);
  box(x, 37, 18, x + 1, 38, 35, BLACK);
}
box(15, 19, 36, 32, 39, 36, BLACK);
for (let x = 17; x <= 30; x++) for (let y = 21; y <= 37; y++) if (x % 3 !== 2) set(x, y, 36, null);
box(23, 36, 37, 24, 37, 38, "#ff8a1f");
for (const x of [15, 31]) box(x, 19, 31, x + 1, 19, 32, "#fff2b0");

// Wheels: two big ones in front, two smaller behind.
wheel(12, 15, 25, 5, 12);
wheel(32, 35, 25, 5, 35);
wheel(13, 15, 36, 4, 13);
wheel(32, 34, 36, 4, 34);

// The mast: two rails, three cross members, the lifting cylinder and its chains.
for (const x of [17, 29]) {
  box(x, 17, 1, x + 1, 19, 40, STEEL.base);
  box(x, 17, 1, x, 17, 40, STEEL.light);
}
for (const z of [3, 22, 40]) box(17, 18, z, 30, 19, z, STEEL.dark);
box(23, 18, 3, 24, 19, 15, DARK);
box(23, 18, 16, 24, 19, 32, STEEL.chrome);
for (let z = 9; z <= 39; z++) { set(21, 18, z, z % 2 ? DARK : STEEL.dark); set(26, 18, z, z % 2 ? DARK : STEEL.dark); }

// The carriage: backplate and load guard, two forks, and on them a small pallet with a crate.
part("carriage", [23.5, 16, 8]);
box(17, 16, 7, 30, 16, 14, DARK);
box(17, 16, 14, 30, 16, 14, GREY);
for (let x = 17; x <= 30; x++) for (let z = 15; z <= 24; z++) if (x === 17 || x === 30 || z === 24 || (x - 17) % 3 === 0) set(x, 16, z, GREY);
for (const x of [19, 27]) {
  box(x, 3, 8, x + 1, 15, 8, STEEL.light);
  box(x, 15, 8, x + 1, 15, 11, STEEL.base);
  set(x, 3, 8, STEEL.chrome); set(x + 1, 3, 8, STEEL.chrome);
}
for (let x = 16; x <= 31; x++)
  for (let y = 4; y <= 14; y++) {
    const inX = x <= 18 || x >= 29 || (x >= 22 && x <= 25), inY = y <= 5 || y >= 13 || (y >= 9 && y <= 10);
    if (inY) set(x, y, 7, WOOD.paleDark);
    if (inX && inY) set(x, y, 8, WOOD.paleDark);
    if ((y - 4) % 3 !== 2) set(x, y, 9, rand() < 0.1 ? WOOD.paleDark : WOOD.pale);
  }
for (let x = 18; x <= 29; x++)
  for (let y = 5; y <= 13; y++)
    for (let z = 10; z <= 18; z++) {
      const ex = x === 18 || x === 29, ey = y === 5 || y === 13, ez = z === 10 || z === 18;
      if (!ex && !ey && !ez) continue;
      const a = ex ? y - 5 : x - 18;
      let c = a % 3 === 0 ? WOOD.groove : WOOD.plank[Math.floor(a / 3) % 2];
      const fx = x - 18 < 2 || 29 - x < 2, fy = y - 5 < 2 || 13 - y < 2, fz = z - 10 < 2 || 18 - z < 2;
      if ((fx ? 1 : 0) + (fy ? 1 : 0) + (fz ? 1 : 0) >= 2) c = z === 18 ? WOOD.frameLight : (ex ? 1 : 0) + (ey ? 1 : 0) + (ez ? 1 : 0) >= 2 ? WOOD.frameDark : WOOD.frame;
      set(x, y, z, c);
    }
part("body");
animate("carriage", { type: "bob", axis: "z", speed: 0.9, amplitude: 4 });