Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
3D: a Cone's picking bounds span its height, not twice it (#98)
shinyobjectz3de2c63babcb
diff --git a/sdk/raea/conformance/events3d.test.tsx b/sdk/raea/conformance/events3d.test.tsxindex 3c2fa2d6..527abebe 100644--- a/sdk/raea/conformance/events3d.test.tsx+++ b/sdk/raea/conformance/events3d.test.tsx@@ -5,7 +5,7 @@ import { events3d, local, onFlat, pickIn, under, worldBounds, IDENTITY, type Lasimport { pick } from "../../render/src/pick";import { Mesh3d, Quat, StandardMaterial } from "../../render/src/bevy3d";import { pickable3d } from "../../render/src/events3d";-import { Sphere } from "../src/3d";+import { Cone, Sphere } from "../src/3d";import { renderFrame } from "../src/test";type P = { x: number; y: number; down: boolean };@@ -155,4 +155,15 @@ describe("a part is picked by its geometry's bounds (FC1b: worked out only for aexpect(parts.get("ball")).toEqual({ name: "ball", sphere: { center: [1, 2, 3], radius: 2 } });expect(parts.has("still")).toBe(false);});++ test("a Cone's bounds span its height, centred on its origin as it's drawn (#98)", () => {+ renderFrame(+ <Mesh3d name="cone" onClick={() => {}}>+ <Cone radius={0.5} height={2} />+ <StandardMaterial />+ </Mesh3d>,+ { frame: 0, width: 320, height: 240, fps: 30, durationInFrames: 30 },+ );+ expect(pickable3d().get("cone")).toEqual({ name: "cone", box: { min: [-0.5, -1, -0.5], max: [0.5, 1, 0.5] } });+ });});diff --git a/sdk/render/src/3d/shapes.tsx b/sdk/render/src/3d/shapes.tsxindex d4f4aab0..00d69ad2 100644--- a/sdk/render/src/3d/shapes.tsx+++ b/sdk/render/src/3d/shapes.tsx@@ -97,7 +97,7 @@ function boundsOf(name: string, a: number[]): LocalBounds | undefined {case "Plane": return box(a[0] / 2, a[1] / 2, 0);case "Cylinder": return box(Math.max(a[0], a[1]), a[2] / 2, Math.max(a[0], a[1]));case "Torus": return box(a[0] + a[1], a[0] + a[1], a[1]);- case "Cone": return box(a[0], a[1], a[0]);+ case "Cone": return box(a[0], a[1] / 2, a[0]);case "Capsule": return box(a[0], a[1] / 2 + a[0], a[0]);}return undefined;