Comment on
Issues with AI Helper
Reply in thread
Literally the code for the imported sword with combat.js:
switch (weaponId) { case 'Sword': { // Blade: diamond cross-section (sharp edges) with shoulder + taper to tip. // The blade points up (+Y). Its flat faces are ±Z by default; to make the // sharp edges face forward/back (±Z in world after pose), we rotate the // whole blade geometry 90° about Y so the edges end up on ±Z. const bladeLen = 0.85; const bladeHalfW = 0.11; // half-width at base (X direction) — narrow blade const bladeHalfT = 0.008; // half-thickness (Z direction) — thin = sharp edge const shoulderLen = 0.35; // length of full-width shoulder (40% of blade) const taperLen = bladeLen - shoulderLen; const bladeMat = new THREE.MeshStandardMaterial({ map: metalTex, roughness: 0.3, metalness: 0.85, flatShading: true }); const flatten = bladeHalfT / bladeHalfW; // Rotate blade so the flat faces are ±X (left/right) and the sharp edges // point ±Z (forward/back toward the enemy in first-person view). const bladeRoll = Math.PI / 2;
// Shoulder: straight cylinder (full width, no taper)
const shoulderGeo = new THREE.CylinderGeometry(bladeHalfW, bladeHalfW, shoulderLen, 4, 1);
shoulderGeo.rotateY(Math.PI / 4);
shoulderGeo.scale(1, 1, flatten);
shoulderGeo.rotateY(bladeRoll);
const flatShoulder = shoulderGeo.toNonIndexed();
flatShoulder.computeVertexNormals();
const shoulderMesh = new THREE.Mesh(flatShoulder, bladeMat);
shoulderMesh.position.set(0, shoulderLen / 2, 0);
// Tapered section: full width at bottom, point at top
const taperGeo = new THREE.CylinderGeometry(0, bladeHalfW, taperLen, 4, 1);
taperGeo.rotateY(Math.PI / 4);
taperGeo.scale(1, 1, flatten);
taperGeo.rotateY(bladeRoll);
const flatTaper = taperGeo.toNonIndexed();
flatTaper.computeVertexNormals();
const taperMesh = new THREE.Mesh(flatTaper, bladeMat);
taperMesh.position.set(0, shoulderLen + taperLen / 2, 0);
const fuller = new THREE.Mesh(
new THREE.BoxGeometry(0.014, bladeLen * 0.5, 0.010),
darkMat
);
fuller.position.set(0, bladeLen * 0.45, 0);
fuller.rotation.y = bladeRoll;
// Crossguard (quillons): horizontal bar with finials — spans blade width (Z)
const guardBar = new THREE.Mesh(
new THREE.CylinderGeometry(0.022, 0.022, 0.16, 12),
darkMat
);
guardBar.rotation.x = Math.PI / 2;
guardBar.position.set(0, 0, 0);
const guardFinL = new THREE.Mesh(new THREE.SphereGeometry(0.03, 12, 12), metalMat);
guardFinL.position.set(0, 0, -0.08);
const guardFinR = new THREE.Mesh(new THREE.SphereGeometry(0.03, 12, 12), metalMat);
guardFinR.position.set(0, 0, 0.08);
// Grip: tapered cylinder with leather-wrap color
const gripMat = new THREE.MeshStandardMaterial({ map: woodTex, color: 0x4a2a10, roughness: 0.95 });
const grip = new THREE.Mesh(
new THREE.CylinderGeometry(0.018, 0.022, 0.17, 12),
gripMat
);
grip.position.set(0, -0.095, 0);
// Pommel: faceted octahedron at the bottom
const pommel = new THREE.Mesh(
new THREE.OctahedronGeometry(0.035, 0),
metalMat
);
pommel.position.set(0, -0.195, 0);
pommel.rotation.x = Math.PI / 4;
group.add(shoulderMesh, taperMesh, fuller, guardBar, guardFinL, guardFinR, grip, pommel);
group.scale.setScalar(0.7);
break;
}
The new AI Helper decided to import assets, meaning I would have to know how to mathematically make this sword, and be able to code that into the core code:
https://user.uploads.dev/file/3112ea4afd41faa86260c94d1a8c07b7.js
Good luck figuring that out.
...and why do you guys think this is easy to do?
Edit: Also, because the file is imported from that combat.js, only AI Helper can edit the sword at this point since most people don't have admin privileges to change those documents that are uploaded.