← GranjaObjeto 3Dfogon/tractor-rojo
Tractor rojo
Arrastrá para girarlo// «Tractor rojo» · gpt-6-sol (medium)
// A cartoon red farm tractor seen from the side, facing -x: a long red engine hood with a front grille and two round headlights, a tall vertical black exhaust pipe on the hood, an open driver seat with a black steering wheel behind it, two huge black rear wheels with chunky tread and yellow hubs, two small black front wheels with yellow hubs, red fenders over the rear wheels.
const red = "#d93629";
const redLight = "#f04b35";
const redDark = "#a92722";
const black = "#202125";
const rubber = "#25272a";
const yellow = "#f5bd27";
const gold = "#d99516";
const steel = "#aeb8b9";
// Undercarriage and axles.
box(9, 18, 10, 36, 30, 14, redDark);
box(7, 19, 12, 38, 29, 15, red);
box(8, 14, 5, 12, 34, 6, "#5e6263");
box(32, 10, 10, 36, 39, 11, "#55585a");
function wheel(cx, cz, y0, y1, r, outerFace) {
for (let y = y0; y <= y1; y++) {
for (let x = cx - r; x <= cx + r; x++) {
for (let z = cz - r; z <= cz + r; z++) {
const dx = x - cx, dz = z - cz;
const d = Math.hypot(dx, dz);
if (d > r + 0.15) continue;
const a = Math.atan2(dz, dx);
const tread = Math.floor((a + Math.PI) * 13 / Math.PI) % 2;
let color = d > r - 2
? (tread ? "#17191b" : "#303235")
: d > r - 4 ? rubber : "#343638";
if (d < r - 4 && rand() < 0.09) color = "#3d3f40";
set(x, y, z, color);
}
}
}
// Raised, staggered tread lugs around the circumference.
for (let i = 0; i < 26; i++) {
const a = i * Math.PI * 2 / 26;
for (let t = -1; t <= 1; t++) {
const x = Math.round(cx + Math.cos(a) * (r - 0.3));
const z = Math.round(cz + Math.sin(a) * (r - 0.3));
set(x, y0 + t + 1, z, i % 2 ? "#383a3b" : "#111315");
set(x, y1 - t - 1, z, i % 2 ? "#383a3b" : "#111315");
}
}
const face = outerFace === "near" ? y0 - 1 : y1 + 1;
const sign = outerFace === "near" ? -1 : 1;
cylinder(cx, face, cz, r * 0.37, 2, "#111315", "y");
// Draw the yellow hub on the outward-facing side.
for (let x = cx - 4; x <= cx + 4; x++) {
for (let z = cz - 4; z <= cz + 4; z++) {
const d = Math.hypot(x - cx, z - cz);
if (d <= r * 0.34) {
set(x, face + sign, z, d > r * 0.27 ? gold : yellow);
}
}
}
set(cx, face + sign * 2, cz, "#fff0a0");
}
// Far wheels first, then the near wheels for a strong side silhouette.
wheel(10, 5, 32, 37, 5, "far");
wheel(34, 10, 31, 39, 10, "far");
wheel(10, 5, 11, 16, 5, "near");
wheel(34, 10, 9, 17, 10, "near");
// Long red engine hood, with a bright, slightly stepped top.
box(7, 17, 15, 26, 31, 22, red);
box(9, 18, 23, 25, 30, 24, redLight);
box(7, 17, 15, 26, 17, 17, redDark);
box(7, 31, 15, 26, 31, 17, redDark);
box(8, 17, 22, 25, 17, 22, "#ed4632");
box(8, 31, 22, 25, 31, 22, "#ed4632");
box(25, 18, 15, 29, 30, 21, redDark);
box(26, 19, 17, 32, 29, 20, red);
box(18, 17, 15, 20, 17, 16, "#f8ba42");
// Front grille, with crisp vertical silver slats.
box(5, 19, 16, 6, 29, 22, "#414346");
box(4, 20, 17, 4, 28, 21, "#24272a");
for (let y = 21; y <= 27; y += 2) {
box(4, y, 17, 4, y, 21, steel);
}
box(4, 19, 16, 5, 29, 16, "#d4d7d1");
box(4, 19, 22, 5, 29, 22, "#d4d7d1");
// Two round lamps, spaced across the nose.
for (const y of [19, 29]) {
sphere(5, y, 21, 2.1, "#454749");
sphere(3.8, y, 21, 1.5, "#ffe08a");
set(3, y, 22, "#fff5c1");
}
// Side vents and a simple cream-painted stripe.
for (const y of [17, 31]) {
for (let x = 11; x <= 19; x += 3) {
box(x, y + (y === 17 ? -1 : 1), 19,
x + 1, y + (y === 17 ? -1 : 1), 21, "#4a3130");
}
box(9, y + (y === 17 ? -1 : 1), 17,
24, y + (y === 17 ? -1 : 1), 17, "#f7c98b");
}
// Tall, dark exhaust stack and its metallic lip.
box(19, 23, 24, 21, 25, 34, black);
box(18, 22, 34, 22, 26, 35, "#383a3a");
box(19, 23, 35, 21, 25, 35, "#6d7170");
box(19, 23, 36, 21, 25, 36, "#303232");
// Driver's raised platform and open seat.
box(27, 18, 19, 40, 30, 21, redDark);
box(29, 19, 22, 39, 29, 23, "#515456");
box(32, 20, 24, 38, 28, 26, "#292a2d");
box(33, 21, 26, 37, 27, 26, "#3a3b3d");
box(38, 20, 25, 40, 28, 31, "#27282b");
box(38, 21, 29, 40, 27, 31, "#3a3b3d");
// Steering column, wheel rim and spokes.
line(30, 24, 21, 28, 24, 28, 1, "#55585a");
for (let i = 0; i < 24; i++) {
const a = i * Math.PI * 2 / 24;
set(28 + Math.cos(a) * 3, 24 + Math.sin(a) * 4, 29, black);
}
line(25, 24, 29, 31, 24, 29, 0, black);
line(28, 20, 29, 28, 28, 29, 0, black);
sphere(28, 24, 29, 1, "#484a4b");
// Red arching fenders hug the tops of the big rear tires.
for (const [y0, y1] of [[8, 11], [38, 41]]) {
for (let x = 22; x <= 45; x++) {
for (let z = 14; z <= 24; z++) {
const d = Math.hypot(x - 34, z - 10);
if (d >= 10.3 && d <= 13.1 && z >= 17) {
box(x, y0, z, x, y1, z,
z >= 22 ? redLight : d > 12.2 ? redDark : red);
}
}
}
box(25, y0, 19, 28, y1, 21, redDark);
box(41, y0, 18, 44, y1, 20, redDark);
}import { draw } from "./assets/voxel";
import { tractorRojo } from "./assets/tractor-rojo";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, tractorRojo, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: lo que mide en px su lado más largo
// angle: giro sobre el piso, en radianes
// t: segundos; si se mueve, se anima solo con eso# En una terminal, en la carpeta del juego
fogon assets add tractor-rojo
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["tractor-rojo"] })
# Queda en client/assets/tractor-rojo.ts
# https://fogon.page/object/tractor-rojo