hz-unity-placement — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited hz-unity-placement (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
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 on the live Editor.
Read and write the scene through unity-cli rather than editing .unity YAML — raw-file edits are invisible to the running Editor and easily hit the wrong scene.
unity status --format json # look for state "ready"See the `unity-cli` skill for connecting, --project-path, and Safe Mode recovery. On a Unity MCP server instead, the same steps apply — use whatever scene-inspection and transform tools it exposes.
When the user requests object placement:
For BOTH objects, locate them and read their bounds:
unity command find_gameobjects --name Cube --format jsonbounds is a computed property, not a serialized field, so get_component_properties does not return it — a MeshRenderer read gives you m_Materials, m_CastShadows and friends, and no bounds at all. Reading bounds always means a script:
// AgentScripts/GetBounds.cs
using System.Text;
using UnityEngine;
public static class GetBounds
{
public static string Run(string[] names)
{
var sb = new StringBuilder();
foreach (var name in names)
{
var go = GameObject.Find(name);
if (go == null) { sb.AppendLine($"{name}: NOT FOUND"); continue; }
if (!TryGetBounds(go, out var b, out var src))
{
sb.AppendLine($"{name}: NO Renderer or Collider - bounds unknown");
continue;
}
sb.AppendLine($"{name} [{src}] center={b.center} size={b.size} extents={b.extents} min={b.min} max={b.max}");
}
return sb.ToString();
}
// Root renderer/collider first; otherwise the union of the children's, which is what an
// imported model needs since its renderers sit on child GameObjects.
private static bool TryGetBounds(GameObject go, out Bounds bounds, out string source)
{
bounds = default;
source = null;
var r = go.GetComponent<Renderer>();
if (r != null) { bounds = r.bounds; source = "Renderer"; return true; }
var col = go.GetComponent<Collider>();
if (col != null) { bounds = col.bounds; source = "Collider"; return true; }
foreach (var cr in go.GetComponentsInChildren<Renderer>())
{
if (source == null) { bounds = cr.bounds; source = "child Renderers"; }
else bounds.Encapsulate(cr.bounds);
}
if (source != null) return true;
foreach (var cc in go.GetComponentsInChildren<Collider>())
{
if (source == null) { bounds = cc.bounds; source = "child Colliders"; }
else bounds.Encapsulate(cc.bounds);
}
return source != null;
}
}unity command run_script --file AgentScripts/GetBounds.cs --entry GetBounds.Run \
--args '[["Cube","Table"]]' --format json`--args` spreads the JSON array as positional parameters, so a single string[] parameter needs a nested array. '["Cube","Table"]' is read as two arguments and fails with "expects 1 argument(s) but 2 were provided".
Understanding 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 sizeIf 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`set_transform` writes `localPosition`, not world position. Verified: on a child of a parent at world x=10, --position "[1,0,0]" yields localPosition (1,0,0) / position (11,0,0). Every formula above produces a world position, so:
unity command set_transform --target Cube --position "[0,1.05,2]" --format json
unity command save_scene --format jsonArray parameters take a JSON array in one argument. --position 0 1.05 2 is rejected with INVALID_COMMAND_ARGS.
transform.position in a script, which is world-spaceby definition:
// AgentScripts/SetWorldPosition.cs
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
public static class SetWorldPosition
{
public static string Run(string name, float x, float y, float z)
{
var go = GameObject.Find(name);
if (go == null) return $"ERROR: '{name}' not found.";
Undo.RecordObject(go.transform, "Place object");
go.transform.position = new Vector3(x, y, z);
EditorSceneManager.MarkSceneDirty(go.scene);
return $"{name}: world={go.transform.position} local={go.transform.localPosition}";
}
} unity command run_script --file AgentScripts/SetWorldPosition.cs \
--entry SetWorldPosition.Run --args '["Cube", 0, 1.05, 2]' --format json
unity command save_scene --format jsonThe script returns both spaces, which is the only way to confirm what landed — get_component_properties --type Transform exposes only m_LocalPosition, so it cannot tell world from local.
After placement, inform the user:
metavr capture screenshot once it's running on a headsetRenderer.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 handledset_transform writes local position. For an unparented object that equals world position; for a parented one it does not, so either convert with parent.InverseTransformPoint(worldPos) or assign transform.position from a run_script and report both values backRenderer.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"
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:
run_script and the bounds reader — get_component_properties does not expose boundsset_transform is local~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.