skills/hz-unity-placement/SKILL.md
Ensures accurate object placement in Unity projects targeting Meta Quest and Horizon OS by using Renderer and Collider bounds when objects are added, moved, or positioned relative to other objects.
npx skillsauth add meta-quest/agentic-tools hz-unity-placementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill ensures that when placing, moving, or positioning Unity GameObjects relative to other objects, proper bounding box calculations are used to prevent overlaps and ensure accurate placement.
Use this skill automatically whenever:
IMPORTANT: Proactively invoke this skill immediately when you detect ANY of these patterns:
refMax.x + 1.0 + targetExtents.xExample 1: "Place all objects on the tables"
Example 2: "Put the mug on the table"
Example 3: "Place the lamp next to the clock"
refMax.x + targetExtents.xExample 4: "Position the book 0.5 meters to the left of the pen"
penMin.x - 0.5 - bookExtents.xExample 1: "Move object to [5, 10, 3]"
Example 2: "Set the cube's position to (0, 0, 0)"
ALWAYS get bounding box information before calculating positions.
Never assume object sizes - always retrieve actual bounds from Renderer or Collider components using whatever Unity MCP tools are available.
When the user requests object placement:
For BOTH objects, retrieve bounds using available Unity MCP tools:
MeshRenderer or Collider components and their bounds propertyUnderstanding bounds types in Unity:
| Property | Space | Accounts for rotation? | Use when |
|----------|-------|----------------------|----------|
| Renderer.bounds | World | Yes (AABB enclosing rotated mesh) | Placing objects in the scene — preferred for placement |
| Renderer.localBounds | Local | No (ignores rotation) | Comparing intrinsic object sizes without rotation effects |
| Collider.bounds | World | Yes (AABB enclosing rotated collider) | Placing objects when no Renderer exists |
Always prefer world-space bounds (Renderer.bounds or Collider.bounds) for placement. These already account for the object's position, rotation, and scale — no manual conversion needed.
If using world-space bounds (preferred — from Renderer.bounds or Collider.bounds):
The values are ready to use directly:
worldCenter = bounds.center // already in world space
worldMin = bounds.min // already in world space
worldMax = bounds.max // already in world space
size = bounds.size // world-space AABB dimensions
extents = bounds.extents // half of size
If using local bounds (from Renderer.localBounds or manual component data):
Convert to world space by adding the object's position:
worldCenter = position + localBounds.center
worldMin = worldCenter - (localBounds.size / 2)
worldMax = worldCenter + (localBounds.size / 2)
Note on rotation: Local bounds ignore rotation. If converting from local bounds on a rotated object, the calculated AABB will not reflect the actual world-space footprint. Prefer world-space bounds whenever possible.
Store these values for each object:
worldCenter: [x, y, z]size: [width, height, depth]extents: [width/2, height/2, depth/2]Based on the spatial relationship, calculate the target position:
On top of (object A on top of object B):
targetY = B.worldMax.y + A.extents.y
targetX = B.worldCenter.x
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
Beside (object A beside object B, +X direction):
targetX = B.worldMax.x + A.extents.x
targetY = B.worldCenter.y
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
In front of (object A in front of object B, +Z direction):
targetX = B.worldCenter.x
targetY = B.worldCenter.y
targetZ = B.worldMax.z + A.extents.z
newPosition = [targetX, targetY, targetZ]
Above (floating above, with gap):
gap = 0.5 // or specified distance
targetY = B.worldMax.y + gap + A.extents.y
targetX = B.worldCenter.x
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
Next to / Beside with distance (object A next to object B, with specified gap):
gap = user_specified_distance // e.g., 0.5 meters
// Right side (+X):
targetX = B.worldMax.x + gap + A.extents.x
// Left side (-X):
targetX = B.worldMin.x - gap - A.extents.x
targetY = B.worldCenter.y // or B.worldMin.y + A.extents.y for ground level
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
X meters/units to the left/right/front/back:
// "2 meters to the right of B"
targetX = B.worldMax.x + 2.0 + A.extents.x
// "1.5 units to the left of B"
targetX = B.worldMin.x - 1.5 - A.extents.x
// "0.5 meters in front of B"
targetZ = B.worldMax.z + 0.5 + A.extents.z
// "1 unit behind B"
targetZ = B.worldMin.z - 1.0 - A.extents.z
Use available Unity MCP tools to set the target object's position to the calculated coordinates.
After placement, inform the user:
Renderer.bounds) are axis-aligned bounding boxes (AABB) that expand to enclose the rotated mesh. A 1x0.1x1 plane rotated 45 degrees on Z will have a taller AABB than when flat. This is correct behavior — the AABB reflects the actual space the object occupies. Always use world-space bounds for placement so rotation is automatically handledRenderer.bounds) are axis-aligned bounding boxes (AABB) that expand to enclose the rotated geometrylocalBounds to compute a surface point, rather than relying on the AABBUser: "Place the Cube on top of the Sphere"
Get Sphere's components and extract bounds:
Get Cube's components and extract bounds:
Calculate new position:
Apply position to Cube
Report: "Placed Cube on top of Sphere at position [0, 2.5, 0]. The Cube (size 1x1x1) sits on the Sphere's top surface (Y=2)."
World-space (Renderer.bounds, Collider.bounds) — use for placement:
bounds.center: World-space center of the AABBbounds.size: Full AABB dimensions (accounts for rotation and scale)bounds.extents: Half dimensions (size / 2)bounds.min: World-space minimum cornerbounds.max: World-space maximum cornerLocal-space (Renderer.localBounds) — use for intrinsic size comparison:
localBounds.center: Local offset from object pivotlocalBounds.size: Intrinsic dimensions (ignores rotation)localBounds.extents: Half dimensions (size / 2)refMax.y + targetExtents.yrefMin.y - targetExtents.yrefMax.x + targetExtents.xrefMin.x - targetExtents.xrefMax.z + targetExtents.zrefMin.z - targetExtents.zrefMax.x + distance + targetExtents.xrefMin.x - distance - targetExtents.xrefMax.z + distance + targetExtents.zrefMin.z - distance - targetExtents.zrefMax.y + distance + targetExtents.yrefMin.y - distance - targetExtents.yrefMax.x + gap + targetExtents.x (or use refMin.x for left side)The goal is to make object placement intuitive and accurate. Always:
tools
Provides the complete metavr (Meta VR CLI) reference for Meta Quest and Horizon OS development — installation, device setup, command discovery, MCP server mode, documentation search, app deployment, device testing setup, audio control, screenshots, and performance analysis. Use when the user needs to install metavr, asks what commands are available, needs CLI syntax help, or wants to know what metavr can do.
development
Guides integration of the Horizon Platform SDK for Meta Quest and Horizon OS Unity/C# apps — achievements, IAP, users, leaderboards, challenges, presence, notifications, abuse reporting, entitlements, asset files, application lifecycle, consent, device integrity, language packs, user age categories, and rate and review. Covers setup, initialization, API usage, data types, error handling, and best practices for all 18 public platform SDK packages.
development
Meta XR Core SDK (com.meta.xr.sdk.core) for Unity XR development. Use when setting up VR/MR projects, configuring OVRManager, adding OVRCameraRig, enabling passthrough, hand tracking, spatial anchors, boundaryless mode, controller input, Scene API, or any Meta Quest XR feature. Covers OVRProjectSetup, AndroidManifest generation, and project configuration for Meta Quest headsets.
development
Build and sideload Android apps for Meta Portal devices (Portal, Portal+, Portal Mini, Portal Go, Portal TV) using metavr. Use when targeting Portal hardware — covers ADB enablement, the no-GMS constraint, manifest/launcher intent-filter requirements, icon density quirks (PNG-only, mipmap-xxxhdpi), the Smart Camera SDK, and the gradle + `metavr adb` build/deploy/debug loop. Auto-load when the user mentions "Portal" device, targets `minSdkVersion` 28-29 for a tabletop/TV form factor, or works with the `com.facebook.portal` package.