Skip to content

Commit bfc7424

Browse files
committed
fix(site): cone lookAt orientation — meshes aim +Z at the target
A Mesh's lookAt() points +Z at the target (three swaps eye/target for non-camera objects; only cameras/lights aim -Z). Rotate the cone tip onto +Z so the tips point at the cursor, not away. Verified in-browser.
1 parent 0622660 commit bfc7424

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

site/src/snippets/09-look-at.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as THREE from "three"
21
import { createSignal, For } from "solid-js"
32
import { Canvas, createT, plugin } from "solid-three"
3+
import * as THREE from "three"
44

55
// A plugin: every Object3D gains a `lookAt` prop that calls three's `lookAt()`.
66
const lookAt = plugin([THREE.Object3D], object => ({
@@ -9,9 +9,10 @@ const lookAt = plugin([THREE.Object3D], object => ({
99

1010
const T = createT(THREE, [lookAt])
1111

12-
// One cone geometry, rotated so its tip points along -Z — the axis `lookAt` aims.
12+
// One cone geometry, rotated so its tip points along +Z — a Mesh's lookAt()
13+
// aims +Z at the target (cameras/lights aim -Z; meshes are the opposite).
1314
const cone = new THREE.ConeGeometry(0.18, 0.7, 24)
14-
cone.rotateX(-Math.PI / 2)
15+
cone.rotateX(Math.PI / 2)
1516

1617
// A 5×5 grid of cone positions in the XY-plane.
1718
const positions: [number, number, number][] = []

0 commit comments

Comments
 (0)