Skip to content

Commit 710f9f3

Browse files
GeneralJerelclaude
andcommitted
fix: add Three.js coordinate conventions to prevent aircraft axis swap
The LLM consistently builds aircraft with the wing as the fuselage (long axis along X instead of Z), causing pitch and roll to appear swapped. Add explicit axis conventions, correct geometry patterns, and flight dynamics rotation mapping to the visualization skill. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9b0694b commit 710f9f3

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

  • apps/agent/skills/advanced-visualization

apps/agent/skills/advanced-visualization/SKILL.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,50 @@ import mermaid from 'https://esm.sh/mermaid@11/dist/mermaid.esm.min.mjs';
698698
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.min.js"></script>
699699
```
700700

701+
### Three.js Coordinate Conventions
702+
703+
Three.js uses a **right-handed Y-up** coordinate system:
704+
- **X** = right (positive) / left (negative)
705+
- **Y** = up (positive) / down (negative)
706+
- **Z** = toward the viewer (positive) / away from the viewer (negative)
707+
708+
**Critical for vehicles and aircraft:** The fuselage/body extends along **Z** (nose at -Z, tail at +Z). Wings extend along **X** (left/right). The vertical stabilizer extends along **Y**.
709+
710+
When building an aircraft from primitives:
711+
- **Fuselage** = cylinder or box, long axis along **Z** (use `geometry` default or rotate 90° around X)
712+
- **Wings** = flat box, wide along **X**, thin along **Y**, short along **Z**
713+
- **Tail fin** = flat box, tall along **Y**, thin along **X**, short along **Z**
714+
715+
```javascript
716+
// Correct aircraft orientation example:
717+
// Fuselage along Z
718+
const fuselage = new THREE.Mesh(
719+
new THREE.CylinderGeometry(0.15, 0.08, 2.0, 12),
720+
material
721+
);
722+
fuselage.rotation.x = Math.PI / 2; // CylinderGeometry default is Y-up, rotate to Z-forward
723+
724+
// Wings along X
725+
const wing = new THREE.Mesh(
726+
new THREE.BoxGeometry(2.5, 0.03, 0.4), // wide X, thin Y, short Z
727+
material
728+
);
729+
730+
// Vertical stabilizer along Y
731+
const tailFin = new THREE.Mesh(
732+
new THREE.BoxGeometry(0.03, 0.4, 0.3), // thin X, tall Y, short Z
733+
material
734+
);
735+
tailFin.position.set(0, 0.2, 0.9); // above and behind
736+
```
737+
738+
**Rotation axes for flight dynamics:**
739+
- **Pitch** = rotation around **X** (nose up/down)
740+
- **Roll** = rotation around **Z** (wings tilt)
741+
- **Yaw** = rotation around **Y** (nose left/right)
742+
743+
**Common mistake:** Using the wing box as the fuselage (wide along X instead of Z). Always verify: the longest dimension of the fuselage should be along Z.
744+
701745
---
702746

703747
## Part 8: Quality Checklist

0 commit comments

Comments
 (0)