1,3 k tris1,05 × 1,70 × 0,47 m
Utiliser dans le code
Remixer dans l’éditeurrobot.js · 275 lignes
Module ES autonome — ne dépend que de three. Appelez la fonction factory et ajoutez le groupe à votre scène.
/**
* Robot — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 1,272 · Size (W × H × D): 1.05 × 1.70 × 0.47 m
*
* Usage:
* import { createRobot } from './robot.js';
*
* const model = createRobot();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
const deg = THREE.MathUtils.degToRad;
export function createRobot() {
const root = new THREE.Group();
root.name = 'Robot';
// Materials
const shellMat = new THREE.MeshStandardMaterial({ name: 'shell', color: 0x5bb6d3, roughness: 0.4, metalness: 0.25, flatShading: true });
const jointMat = new THREE.MeshStandardMaterial({ name: 'joint', color: 0x3d4452, roughness: 0.5, metalness: 0.5, flatShading: true });
const chromeMat = new THREE.MeshStandardMaterial({ name: 'chrome', color: 0xc9d1da, roughness: 0.25, metalness: 0.8, flatShading: true });
const screenMat = new THREE.MeshStandardMaterial({ name: 'screen', color: 0x141a26, roughness: 0.2, flatShading: true });
const glowMat = new THREE.MeshStandardMaterial({ name: 'glow', color: 0x8af7ff, roughness: 0.3, emissive: 0x8af7ff, emissiveIntensity: 0.9, flatShading: true });
const lightMat = new THREE.MeshStandardMaterial({ name: 'light', color: 0xff6a5c, roughness: 0.3, emissive: 0xff5040, emissiveIntensity: 0.9, flatShading: true });
const limeMat = new THREE.MeshStandardMaterial({ name: 'lime', color: 0x9cf06b, roughness: 0.3, emissive: 0x8ef05c, emissiveIntensity: 0.8, flatShading: true });
// Shared geometries
const cylinderGeo = new THREE.CylinderGeometry(0.055, 0.055, 0.16, 8);
const boxGeo = new THREE.BoxGeometry(0.17, 0.17, 0.19);
const boxGeo2 = new THREE.BoxGeometry(0.21, 0.08, 0.3);
const boxGeo3 = new THREE.BoxGeometry(0.19, 0.03, 0.05);
const boxGeo4 = new THREE.BoxGeometry(0.06, 0.06, 0.012);
const boxGeo5 = new THREE.BoxGeometry(0.26, 0.018, 0.012);
const cylinderGeo2 = new THREE.CylinderGeometry(0.04, 0.04, 0.03, 8);
const sphereGeo = new THREE.SphereGeometry(0.085, 8, 6);
const boxGeo6 = new THREE.BoxGeometry(0.13, 0.22, 0.14);
const cylinderGeo3 = new THREE.CylinderGeometry(0.045, 0.045, 0.08, 8);
const boxGeo7 = new THREE.BoxGeometry(0.12, 0.16, 0.13);
const torusGeo = new THREE.TorusGeometry(0.075, 0.028, 5, 10, 4.5553);
const cylinderGeo4 = new THREE.CylinderGeometry(0.05, 0.05, 0.012, 10);
const cylinderGeo5 = new THREE.CylinderGeometry(0.075, 0.075, 0.05, 10);
const cylinderGeo6 = new THREE.CylinderGeometry(0.04, 0.04, 0.02, 8);
// Parts
const legL = new THREE.Group();
legL.name = 'legL';
legL.position.set(0.15, 0.42, 0);
root.add(legL);
const thighL = new THREE.Mesh(cylinderGeo, jointMat);
thighL.name = 'thighL';
thighL.position.set(0, -0.08, 0);
legL.add(thighL);
const shinL = new THREE.Mesh(boxGeo, shellMat);
shinL.name = 'shinL';
shinL.position.set(0, -0.24, 0);
legL.add(shinL);
const footL = new THREE.Mesh(boxGeo2, jointMat);
footL.name = 'footL';
footL.position.set(0, -0.38, 0.03);
legL.add(footL);
const toeCapL = new THREE.Mesh(boxGeo3, chromeMat);
toeCapL.name = 'toeCapL';
toeCapL.position.set(0, -0.36, 0.165);
legL.add(toeCapL);
const legR = new THREE.Group();
legR.name = 'legR';
legR.position.set(-0.15, 0.42, 0);
root.add(legR);
const thighR = new THREE.Mesh(cylinderGeo, jointMat);
thighR.name = 'thighR';
thighR.position.set(0, -0.08, 0);
legR.add(thighR);
const shinR = new THREE.Mesh(boxGeo, shellMat);
shinR.name = 'shinR';
shinR.position.set(0, -0.24, 0);
legR.add(shinR);
const footR = new THREE.Mesh(boxGeo2, jointMat);
footR.name = 'footR';
footR.position.set(0, -0.38, 0.03);
legR.add(footR);
const toeCapR = new THREE.Mesh(boxGeo3, chromeMat);
toeCapR.name = 'toeCapR';
toeCapR.position.set(0, -0.36, 0.165);
legR.add(toeCapR);
const body = new THREE.Group();
body.name = 'body';
root.add(body);
const chest = new THREE.Mesh(new THREE.BoxGeometry(0.6, 0.52, 0.42), shellMat);
chest.name = 'chest';
chest.position.set(0, 0.66, 0);
body.add(chest);
const waist = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.06, 0.36), jointMat);
waist.name = 'waist';
waist.position.set(0, 0.4, 0);
body.add(waist);
const chestPanel = new THREE.Mesh(new THREE.BoxGeometry(0.36, 0.24, 0.02), screenMat);
chestPanel.name = 'chestPanel';
chestPanel.position.set(0, 0.7, 0.215);
body.add(chestPanel);
const statusRed = new THREE.Mesh(boxGeo4, lightMat);
statusRed.name = 'statusRed';
statusRed.position.set(-0.1, 0.74, 0.227);
body.add(statusRed);
const statusGreen = new THREE.Mesh(boxGeo4, limeMat);
statusGreen.name = 'statusGreen';
statusGreen.position.set(0, 0.74, 0.227);
body.add(statusGreen);
const statusBlue = new THREE.Mesh(boxGeo4, glowMat);
statusBlue.name = 'statusBlue';
statusBlue.position.set(0.1, 0.74, 0.227);
body.add(statusBlue);
const grille1 = new THREE.Mesh(boxGeo5, chromeMat);
grille1.name = 'grille1';
grille1.position.set(0, 0.65, 0.227);
body.add(grille1);
const grille2 = new THREE.Mesh(boxGeo5, chromeMat);
grille2.name = 'grille2';
grille2.position.set(0, 0.615, 0.227);
body.add(grille2);
const grille3 = new THREE.Mesh(boxGeo5, chromeMat);
grille3.name = 'grille3';
grille3.position.set(0, 0.58, 0.227);
body.add(grille3);
const boltL = new THREE.Mesh(cylinderGeo2, chromeMat);
boltL.name = 'boltL';
boltL.position.set(0.31, 0.54, 0);
boltL.rotation.set(0, 0, deg(90));
body.add(boltL);
const boltR = new THREE.Mesh(cylinderGeo2, chromeMat);
boltR.name = 'boltR';
boltR.position.set(-0.31, 0.54, 0);
boltR.rotation.set(0, 0, deg(90));
body.add(boltR);
const neck = new THREE.Mesh(new THREE.CylinderGeometry(0.08, 0.1, 0.08, 8), jointMat);
neck.name = 'neck';
neck.position.set(0, 0.96, 0);
body.add(neck);
const armL = new THREE.Group();
armL.name = 'armL';
armL.position.set(0.36, 0.9, 0);
armL.rotation.set(0, 0, deg(9));
root.add(armL);
const shoulderL = new THREE.Mesh(sphereGeo, jointMat);
shoulderL.name = 'shoulderL';
shoulderL.position.set(0.02, 0, 0);
armL.add(shoulderL);
const upperArmL = new THREE.Mesh(boxGeo6, shellMat);
upperArmL.name = 'upperArmL';
upperArmL.position.set(0.03, -0.15, 0);
armL.add(upperArmL);
const elbowL = new THREE.Mesh(cylinderGeo3, jointMat);
elbowL.name = 'elbowL';
elbowL.position.set(0.03, -0.3, 0);
armL.add(elbowL);
const forearmL = new THREE.Mesh(boxGeo7, shellMat);
forearmL.name = 'forearmL';
forearmL.position.set(0.03, -0.41, 0);
armL.add(forearmL);
const clawL = new THREE.Mesh(torusGeo, chromeMat);
clawL.name = 'clawL';
clawL.position.set(0.03, -0.57, 0);
clawL.rotation.set(0, deg(90), deg(220));
armL.add(clawL);
const armR = new THREE.Group();
armR.name = 'armR';
armR.position.set(-0.36, 0.9, 0);
armR.rotation.set(0, 0, deg(-9));
root.add(armR);
const shoulderR = new THREE.Mesh(sphereGeo, jointMat);
shoulderR.name = 'shoulderR';
shoulderR.position.set(-0.02, 0, 0);
armR.add(shoulderR);
const upperArmR = new THREE.Mesh(boxGeo6, shellMat);
upperArmR.name = 'upperArmR';
upperArmR.position.set(-0.03, -0.15, 0);
armR.add(upperArmR);
const elbowR = new THREE.Mesh(cylinderGeo3, jointMat);
elbowR.name = 'elbowR';
elbowR.position.set(-0.03, -0.3, 0);
armR.add(elbowR);
const forearmR = new THREE.Mesh(boxGeo7, shellMat);
forearmR.name = 'forearmR';
forearmR.position.set(-0.03, -0.41, 0);
armR.add(forearmR);
const clawR = new THREE.Mesh(torusGeo, chromeMat);
clawR.name = 'clawR';
clawR.position.set(-0.03, -0.57, 0);
clawR.rotation.set(0, deg(90), deg(220));
armR.add(clawR);
const head = new THREE.Group();
head.name = 'head';
head.position.set(0, 0.94, 0);
root.add(head);
const headShell = new THREE.Mesh(new THREE.BoxGeometry(0.56, 0.42, 0.44), shellMat);
headShell.name = 'headShell';
headShell.position.set(0, 0.23, 0);
head.add(headShell);
const faceScreen = new THREE.Mesh(new THREE.BoxGeometry(0.46, 0.3, 0.02), screenMat);
faceScreen.name = 'faceScreen';
faceScreen.position.set(0, 0.23, 0.225);
head.add(faceScreen);
const eyeL = new THREE.Mesh(cylinderGeo4, glowMat);
eyeL.name = 'eyeL';
eyeL.position.set(0.11, 0.265, 0.237);
eyeL.rotation.set(deg(90), 0, 0);
eyeL.scale.set(0.85, 1, 1.1);
head.add(eyeL);
const eyeR = new THREE.Mesh(cylinderGeo4, glowMat);
eyeR.name = 'eyeR';
eyeR.position.set(-0.11, 0.265, 0.237);
eyeR.rotation.set(deg(90), 0, 0);
eyeR.scale.set(0.85, 1, 1.1);
head.add(eyeR);
const smile = new THREE.Mesh(new THREE.TorusGeometry(0.065, 0.014, 4, 8, Math.PI), glowMat);
smile.name = 'smile';
smile.position.set(0, 0.205, 0.237);
smile.rotation.set(0, 0, deg(180));
smile.scale.set(1, 0.7, 0.4);
head.add(smile);
const earL = new THREE.Mesh(cylinderGeo5, jointMat);
earL.name = 'earL';
earL.position.set(0.3, 0.23, 0);
earL.rotation.set(0, 0, deg(90));
head.add(earL);
const earLightL = new THREE.Mesh(cylinderGeo6, glowMat);
earLightL.name = 'earLightL';
earLightL.position.set(0.33, 0.23, 0);
earLightL.rotation.set(0, 0, deg(90));
head.add(earLightL);
const earR = new THREE.Mesh(cylinderGeo5, jointMat);
earR.name = 'earR';
earR.position.set(-0.3, 0.23, 0);
earR.rotation.set(0, 0, deg(90));
head.add(earR);
const earLightR = new THREE.Mesh(cylinderGeo6, glowMat);
earLightR.name = 'earLightR';
earLightR.position.set(-0.33, 0.23, 0);
earLightR.rotation.set(0, 0, deg(90));
head.add(earLightR);
const headBand = new THREE.Mesh(new THREE.BoxGeometry(0.57, 0.04, 0.45), jointMat);
headBand.name = 'headBand';
headBand.position.set(0, 0.4, 0);
head.add(headBand);
const antenna = new THREE.Group();
antenna.name = 'antenna';
antenna.position.set(0.06, 0.44, -0.04);
antenna.rotation.set(0, 0, deg(-8));
head.add(antenna);
const antennaBase = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.06, 0.04, 8), jointMat);
antennaBase.name = 'antennaBase';
antennaBase.position.set(0, 0.02, 0);
antenna.add(antennaBase);
const antennaRod = new THREE.Mesh(new THREE.CylinderGeometry(0.012, 0.012, 0.22, 6), chromeMat);
antennaRod.name = 'antennaRod';
antennaRod.position.set(0, 0.15, 0);
antenna.add(antennaRod);
const antennaLight = new THREE.Mesh(new THREE.SphereGeometry(0.045, 8, 6), lightMat);
antennaLight.name = 'antennaLight';
antennaLight.position.set(0, 0.28, 0);
antenna.add(antennaLight);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createRobot;
Notes et commentaires
0 commentaire
Aucun commentaire pour l’instant. Dites comment vous avez utilisé ce modèle ou ce qui pourrait être amélioré.
Modèles similaires
Même catégorie ou étiquettes proches









