hz-unity-placement

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Unity Object Placement with Bounding Boxes

基于边界框的Unity对象放置

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.
该技能可确保在相对于其他对象放置、移动或定位Unity GameObject时,使用正确的边界框计算来避免重叠并保证放置的准确性。

When to use this skill

何时使用此技能

Use this skill automatically whenever:
  • Placing an object relative to another (on top of, beside, above, below, in front of, behind)
  • Moving objects to specific positions near other objects
  • Instantiating prefabs in relation to existing scene objects
  • Positioning imported models relative to scene objects
  • Any spatial relationship between GameObjects is specified
在以下场景中自动使用此技能:
  • 将一个对象相对于另一个对象放置(在上方、旁边、正上方、正下方、前方、后方)
  • 将对象移动到其他对象附近的特定位置
  • 相对于场景中现有对象实例化预制件
  • 将导入的模型相对于场景对象定位
  • 指定GameObject之间的任何空间关系

Automatic Triggers (invoke WITHOUT user asking)

自动触发条件(无需用户请求即可调用)

IMPORTANT: Proactively invoke this skill immediately when you detect ANY of these patterns:
重要提示:当检测到以下任何模式时,请立即主动调用此技能:

Placement Language Triggers

放置语言触发词

  • User says "place X on Y" or "put X on Y"
  • User says "place X next to Y" or "put X beside Y"
  • User says "place X to the left/right of Y"
  • User says "place X in front of/behind Y"
  • User says "place X above/below Y"
  • User says "position X near/around Y"
  • User says "arrange X on/around Y"
  • User requests "X meters/units to the left/right/front/back of Y"
  • 用户说 "将X放在Y上""把X放到Y上"
  • 用户说 "将X放在Y旁边""把X放到Y身旁"
  • 用户说 "将X放在Y的左侧/右侧"
  • 用户说 "将X放在Y的前方/后方"
  • 用户说 "将X放在Y的正上方/正下方"
  • 用户说 "将X定位在Y附近/周围"
  • 用户说 "将X排列在Y上/周围"
  • 用户要求 "在Y的左侧/右侧/前方/后方X米/单位处"

Multi-Object Scenarios

多对象场景

  • Before ANY GameObject position modification involving multiple objects and spatial relationships
  • When importing models that will be positioned relative to existing objects
  • When arranging/organizing multiple objects in a scene
  • When setting up object hierarchies with spatial relationships
  • 任何涉及多个对象和空间关系的GameObject位置修改之前
  • 导入将相对于现有对象定位的模型时
  • 在场景中排列/组织多个对象时
  • 设置带有空间关系的对象层级结构时

Distance-Based Placement

基于距离的放置

  • User specifies distances: "2 meters to the left", "0.5 units above", etc.
  • Combine specified distance with bounding box calculations
  • Example: "1 meter to the right" =
    refMax.x + 1.0 + targetExtents.x
  • 用户指定距离:"左侧2米"、"上方0.5单位"等
  • 将指定距离与边界框计算相结合
  • 示例:"右侧1米" =
    refMax.x + 1.0 + targetExtents.x

Example Scenarios

示例场景

Auto-Invoke Skill (Do These Immediately)

自动调用技能(立即执行)

Example 1: "Place all objects on the tables"
  • Action: Invoke unity-placement skill immediately
  • Why: Multiple objects being placed relative to tables
Example 2: "Put the mug on the table"
  • Action: Invoke unity-placement skill
  • Why: Single object placement with "on" relationship
Example 3: "Place the lamp next to the clock"
  • Action: Invoke unity-placement skill
  • Why: "next to" indicates horizontal spatial relationship
  • Process: Get both bounds, place lamp beside clock using
    refMax.x + targetExtents.x
Example 4: "Position the book 0.5 meters to the left of the pen"
  • Action: Invoke unity-placement skill
  • Why: Distance-based placement with spatial relationship
  • Process: Get bounds, calculate:
    penMin.x - 0.5 - bookExtents.x
示例1:"将所有对象放在桌子上"
  • 操作:立即调用unity-placement技能
  • 原因:多个对象将相对于桌子放置
示例2:"把杯子放在桌子上"
  • 操作:调用unity-placement技能
  • 原因:单个对象的放置存在"在...上"的关系
示例3:"将灯放在时钟旁边"
  • 操作:调用unity-placement技能
  • 原因:"旁边"表示水平空间关系
  • 流程:获取两者的边界,使用
    refMax.x + targetExtents.x
    将灯放在时钟旁边
示例4:"将书定位在钢笔左侧0.5米处"
  • 操作:调用unity-placement技能
  • 原因:基于距离的放置且存在空间关系
  • 流程:获取边界,计算:
    penMin.x - 0.5 - bookExtents.x

Don't Invoke Skill (Direct Operations)

无需调用技能(直接操作)

Example 1: "Move object to [5, 10, 3]"
  • Why: Direct coordinates provided, no relative positioning
Example 2: "Set the cube's position to (0, 0, 0)"
  • Why: Absolute position, no reference object
示例1:"将对象移动到[5, 10, 3]"
  • 原因:提供了直接坐标,不存在相对定位
示例2:"将立方体的位置设置为(0, 0, 0)"
  • 原因:绝对位置,无参考对象

Core principle

核心原则

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.
计算位置前务必获取边界框信息。
永远不要假设对象大小——始终使用可用的Unity MCP工具从Renderer或Collider组件中获取实际边界。

Instructions

操作步骤

Step 1: Identify the objects involved

步骤1:识别涉及的对象

When the user requests object placement:
  1. Identify the target object (the one being placed/moved)
  2. Identify the reference object (the one it's being placed relative to)
  3. Note the desired spatial relationship (on, beside, above, etc.)
当用户请求对象放置时:
  1. 识别目标对象(被放置/移动的对象)
  2. 识别参考对象(目标对象将相对于其放置的对象)
  3. 记录所需的空间关系(在上方、旁边、正上方等)

Step 2: Get bounding box information

步骤2:获取边界框信息

For BOTH objects, retrieve bounds using available Unity MCP tools:
  1. Find each object in the scene by name or path
  2. Query the object's components to extract bounds information
  3. Look for
    MeshRenderer
    or
    Collider
    components and their
    bounds
    property
Understanding bounds types in Unity:
PropertySpaceAccounts for rotation?Use when
Renderer.bounds
WorldYes (AABB enclosing rotated mesh)Placing objects in the scene — preferred for placement
Renderer.localBounds
LocalNo (ignores rotation)Comparing intrinsic object sizes without rotation effects
Collider.bounds
WorldYes (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.
对于两个对象,使用可用的Unity MCP工具获取边界:
  1. 通过名称或路径在场景中找到每个对象
  2. 查询对象的组件以提取边界信息
  3. 查找
    MeshRenderer
    Collider
    组件及其
    bounds
    属性
理解Unity中的边界类型:
属性空间是否考虑旋转?使用场景
Renderer.bounds
世界空间是(包围旋转网格的轴对齐边界框AABB)在场景中放置对象——放置时的首选
Renderer.localBounds
局部空间否(忽略旋转)比较对象的固有大小,不受旋转影响
Collider.bounds
世界空间是(包围旋转碰撞体的轴对齐边界框AABB)当不存在Renderer时放置对象
放置时始终优先使用世界空间边界
Renderer.bounds
Collider.bounds
)。这些边界已考虑对象的位置、旋转和缩放——无需手动转换。

Step 3: Use world bounds directly (or convert from local)

步骤3:直接使用世界边界(或从局部空间转换)

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]
如果使用世界空间边界(首选——来自
Renderer.bounds
Collider.bounds
):
这些值可直接使用:
worldCenter = bounds.center    // 已处于世界空间
worldMin = bounds.min          // 已处于世界空间
worldMax = bounds.max          // 已处于世界空间
size = bounds.size             // 世界空间AABB的尺寸
extents = bounds.extents       // size的一半
如果使用局部空间边界(来自
Renderer.localBounds
或手动组件数据):
通过添加对象的位置转换为世界空间:
worldCenter = position + localBounds.center
worldMin = worldCenter - (localBounds.size / 2)
worldMax = worldCenter + (localBounds.size / 2)
关于旋转的注意事项:局部边界忽略旋转。如果从旋转对象的局部边界转换,计算出的AABB将无法反映实际的世界空间占用范围。尽可能优先使用世界空间边界。
为每个对象存储以下值:
  • worldCenter
    : [x, y, z]
  • size
    : [宽度, 高度, 深度]
  • extents
    : [宽度/2, 高度/2, 深度/2]

Step 4: Calculate placement position

步骤4:计算放置位置

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
根据空间关系,计算目标位置:
在上方(对象A在对象B上方):
targetY = B.worldMax.y + A.extents.y
targetX = B.worldCenter.x
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
在旁边(对象A在对象B的+X方向旁边):
targetX = B.worldMax.x + A.extents.x
targetY = B.worldCenter.y
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
在前方(对象A在对象B的+Z方向前方):
targetX = B.worldCenter.x
targetY = B.worldCenter.y
targetZ = B.worldMax.z + A.extents.z
newPosition = [targetX, targetY, targetZ]
在正上方(悬浮在上方,带有间隙):
gap = 0.5  // 或指定的距离
targetY = B.worldMax.y + gap + A.extents.y
targetX = B.worldCenter.x
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
在旁边/身旁(带间隙)(对象A在对象B旁边,带有指定间隙):
gap = user_specified_distance  // 例如,0.5米
// 右侧(+X):
targetX = B.worldMax.x + gap + A.extents.x
// 左侧(-X):
targetX = B.worldMin.x - gap - A.extents.x
targetY = B.worldCenter.y  // 或B.worldMin.y + A.extents.y以贴合地面
targetZ = B.worldCenter.z
newPosition = [targetX, targetY, targetZ]
左侧/右侧/前方/后方X米/单位处
// "在B右侧2米处"
targetX = B.worldMax.x + 2.0 + A.extents.x

// "在B左侧1.5单位处"
targetX = B.worldMin.x - 1.5 - A.extents.x

// "在B前方0.5米处"
targetZ = B.worldMax.z + 0.5 + A.extents.z

// "在B后方1单位处"
targetZ = B.worldMin.z - 1.0 - A.extents.z

Step 5: Apply the position

步骤5:应用位置

Use available Unity MCP tools to set the target object's position to the calculated coordinates.
使用可用的Unity MCP工具将目标对象的位置设置为计算出的坐标。

Step 6: Verify placement

步骤6:验证放置

After placement, inform the user:
  • The calculated position
  • The bounds that were used
  • Any adjustments made
  • Suggest they check the Scene view
放置完成后,告知用户:
  • 计算出的位置
  • 使用的边界信息
  • 所做的任何调整
  • 建议他们检查Scene视图

Common placement patterns

常见放置模式

On top (stacking)

在上方(堆叠)

  • Use reference object's top surface (worldMax.y)
  • Add target object's half-height (extents.y)
  • Align centers horizontally (X, Z match)
  • 使用参考对象的顶部表面(worldMax.y)
  • 添加目标对象的半高(extents.y)
  • 水平方向对齐中心(X、Z匹配)

Beside (horizontal adjacency)

在旁边(水平相邻)

  • Use reference object's side surface (worldMax.x or worldMin.x)
  • Add target object's half-width (extents.x)
  • Align centers vertically (Y matches) and depth-wise (Z matches)
  • 使用参考对象的侧面(worldMax.x或worldMin.x)
  • 添加目标对象的半宽(extents.x)
  • 垂直方向(Y匹配)和深度方向(Z匹配)对齐中心

In front / Behind

在前方/后方

  • Use reference object's front/back surface (worldMax.z or worldMin.z)
  • Add target object's half-depth (extents.z)
  • Align centers (X, Y match)
  • 使用参考对象的前/后表面(worldMax.z或worldMin.z)
  • 添加目标对象的半深度(extents.z)
  • 对齐中心(X、Y匹配)

At specific offset

特定偏移量

  • Start with reference object's center
  • Add custom offset
  • Still account for target object's extents to ensure proper grounding
  • 从参考对象的中心开始
  • 添加自定义偏移量
  • 仍需考虑目标对象的范围以确保正确贴合

Best practices

最佳实践

  1. Always get fresh bounds: Don't cache bounds - always retrieve before placement
  2. Account for scale: World-space bounds already include object scale
  3. Account for rotation: World-space bounds (
    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 handled
  4. Handle missing renderers: If no Renderer, check for Colliders; if neither, warn the user
  5. Explain calculations: Show your work - tell the user what bounds were found and how position was calculated
  6. Local vs world positions: MCP tools may accept local or world positions - calculate accordingly and be aware of parent transforms. When an object has a parent, its position is in parent-local space
  7. Handle prefabs: When instantiating prefabs, get their bounds after instantiation
  1. 始终获取最新边界:不要缓存边界——放置前始终重新获取
  2. 考虑缩放:世界空间边界已包含对象缩放
  3. 考虑旋转:世界空间边界(
    Renderer.bounds
    )是轴对齐边界框(AABB),会扩展以包围旋转后的网格。一个1x0.1x1的平面绕Z轴旋转45度后,其AABB会比平面状态时更高。这是正确的行为——AABB反映了对象实际占用的空间。放置时始终使用世界空间边界,这样旋转会被自动处理
  4. 处理缺失的Renderer:如果没有Renderer,检查是否有Collider;如果两者都没有,向用户发出警告
  5. 解释计算过程:展示你的操作——告知用户找到的边界以及位置的计算方式
  6. 局部位置与世界位置:MCP工具可能接受局部或世界位置——相应地进行计算,并注意父变换。当对象有父对象时,其位置处于父对象的局部空间
  7. 处理预制件:实例化预制件时,在实例化后获取其边界

Handling edge cases

处理边缘情况

Object has no Renderer or Collider

对象没有Renderer或Collider

  • Warn the user that bounds cannot be determined
  • Suggest adding a Collider or ask for manual dimensions
  • Fall back to assuming zero size at object's pivot
  • 警告用户无法确定边界
  • 建议添加Collider或请求手动输入尺寸
  • 退回到假设对象轴心处尺寸为零

Multiple Renderers (parent with children)

多个Renderer(父对象带有子对象)

  • Use the parent's Renderer if available
  • If parent has no Renderer, calculate combined bounds from children
  • Note this to the user
  • 如果父对象有Renderer,使用父对象的Renderer
  • 如果父对象没有Renderer,从子对象计算组合边界
  • 向用户说明这一点

Rotated objects

旋转对象

  • World-space bounds (
    Renderer.bounds
    ) are axis-aligned bounding boxes (AABB) that expand to enclose the rotated geometry
  • A rotated object's AABB is typically larger than the object's visual silhouette, which may create visible gaps when placing objects flush against it
  • This is expected — warn the user if the gap looks undesirable and suggest adjusting rotation or using a manual offset
  • If the user needs tight placement against a rotated surface, consider using the object's local forward/up/right vectors with
    localBounds
    to compute a surface point, rather than relying on the AABB
  • 世界空间边界(
    Renderer.bounds
    )是轴对齐边界框(AABB),会扩展以包围旋转后的几何体
  • 旋转对象的AABB通常比对象的视觉轮廓大,这可能导致将对象紧贴放置时出现可见间隙
  • 这是预期情况——如果间隙看起来不符合需求,警告用户并建议调整旋转或使用手动偏移
  • 如果用户需要紧贴旋转表面放置,考虑使用对象的局部前/上/右向量和
    localBounds
    计算表面点,而不是依赖AABB

Irregular shapes

不规则形状

  • Bounds are axis-aligned boxes (AABB) — they represent the smallest box aligned to world axes that fully contains the mesh
  • They may be significantly larger than the visible mesh for non-box shapes (e.g., a diagonal beam, a sphere's AABB has empty corners)
  • Note this to the user when placement gaps appear
  • 边界是轴对齐框(AABB)——它们代表与世界轴对齐的最小盒子,可完全包含网格
  • 对于非盒状形状(例如斜梁、球体的AABB会有空角),边界可能比可见网格大得多
  • 当出现放置间隙时,向用户说明这一点

Very small or very large objects

极小或极大的对象

  • Verify bounds seem reasonable (size > 0)
  • Warn if extents are extremely small (< 0.01) or large (> 100)
  • 验证边界是否合理(尺寸>0)
  • 如果范围极小(<0.01)或极大(>100),发出警告

Example workflow

示例工作流程

User: "Place the Cube on top of the Sphere"
  1. Get Sphere's components and extract bounds:
    • Size: [2, 2, 2], Position: [0, 1, 0]
    • World center: [0, 1, 0], Extents: [1, 1, 1]
    • World max Y: 2
  2. Get Cube's components and extract bounds:
    • Size: [1, 1, 1], Current position: [5, 0, 0]
    • Extents: [0.5, 0.5, 0.5]
  3. Calculate new position:
    • Target Y: 2 (Sphere top) + 0.5 (Cube half-height) = 2.5
    • Target X: 0 (Sphere center X)
    • Target Z: 0 (Sphere center Z)
    • New position: [0, 2.5, 0]
  4. Apply position to Cube
  5. 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)."
用户:"将立方体放在球体上方"
  1. 获取球体的组件并提取边界:
    • 尺寸:[2, 2, 2],位置:[0, 1, 0]
    • 世界中心:[0, 1, 0],范围:[1, 1, 1]
    • 世界最大Y值:2
  2. 获取立方体的组件并提取边界:
    • 尺寸:[1, 1, 1],当前位置:[5, 0, 0]
    • 范围:[0.5, 0.5, 0.5]
  3. 计算新位置:
    • 目标Y值:2(球体顶部) + 0.5(立方体半高) = 2.5
    • 目标X值:0(球体中心X)
    • 目标Z值:0(球体中心Z)
    • 新位置:[0, 2.5, 0]
  4. 将位置应用到立方体
  5. 反馈:"已将立方体放置在球体上方的[0, 2.5, 0]位置。立方体(尺寸1x1x1)位于球体的顶部表面(Y=2)。"

Quick reference

快速参考

Coordinate axes in Unity

Unity中的坐标轴

  • X: Right (+) / Left (-)
  • Y: Up (+) / Down (-)
  • Z: Forward (+) / Back (-)
  • X:右(+)/左(-)
  • Y:上(+)/下(-)
  • Z:前(+)/后(-)

Common bounds properties

常见边界属性

World-space (
Renderer.bounds
,
Collider.bounds
) — use for placement:
  • bounds.center
    : World-space center of the AABB
  • bounds.size
    : Full AABB dimensions (accounts for rotation and scale)
  • bounds.extents
    : Half dimensions (size / 2)
  • bounds.min
    : World-space minimum corner
  • bounds.max
    : World-space maximum corner
Local-space (
Renderer.localBounds
) — use for intrinsic size comparison:
  • localBounds.center
    : Local offset from object pivot
  • localBounds.size
    : Intrinsic dimensions (ignores rotation)
  • localBounds.extents
    : Half dimensions (size / 2)
世界空间
Renderer.bounds
,
Collider.bounds
)——用于放置:
  • bounds.center
    : AABB的世界空间中心
  • bounds.size
    : AABB的完整尺寸(考虑旋转和缩放)
  • bounds.extents
    : 半尺寸(size / 2)
  • bounds.min
    : 世界空间的最小角
  • bounds.max
    : 世界空间的最大角
局部空间
Renderer.localBounds
)——用于固有大小比较:
  • localBounds.center
    : 相对于对象轴心的局部偏移
  • localBounds.size
    : 固有尺寸(忽略旋转)
  • localBounds.extents
    : 半尺寸(size / 2)

Placement formulas

放置公式

  • On top:
    refMax.y + targetExtents.y
  • Below:
    refMin.y - targetExtents.y
  • Right of:
    refMax.x + targetExtents.x
  • Left of:
    refMin.x - targetExtents.x
  • In front:
    refMax.z + targetExtents.z
  • Behind:
    refMin.z - targetExtents.z
  • 在上方
    refMax.y + targetExtents.y
  • 在下方
    refMin.y - targetExtents.y
  • 在右侧
    refMax.x + targetExtents.x
  • 在左侧
    refMin.x - targetExtents.x
  • 在前方
    refMax.z + targetExtents.z
  • 在后方
    refMin.z - targetExtents.z

Distance-based placement formulas

基于距离的放置公式

  • X units to the right:
    refMax.x + distance + targetExtents.x
  • X units to the left:
    refMin.x - distance - targetExtents.x
  • X units in front:
    refMax.z + distance + targetExtents.z
  • X units behind:
    refMin.z - distance - targetExtents.z
  • X units above:
    refMax.y + distance + targetExtents.y
  • X units below:
    refMin.y - distance - targetExtents.y
  • Next to with gap:
    refMax.x + gap + targetExtents.x
    (or use refMin.x for left side)
  • 右侧X单位处
    refMax.x + distance + targetExtents.x
  • 左侧X单位处
    refMin.x - distance - targetExtents.x
  • 前方X单位处
    refMax.z + distance + targetExtents.z
  • 后方X单位处
    refMin.z - distance - targetExtents.z
  • 上方X单位处
    refMax.y + distance + targetExtents.y
  • 下方X单位处
    refMin.y - distance - targetExtents.y
  • 带间隙的旁边
    refMax.x + gap + targetExtents.x
    (左侧使用refMin.x)

Remember

谨记

The goal is to make object placement intuitive and accurate. Always:
  1. Get actual bounds from components using available Unity MCP tools
  2. Calculate world-space positions
  3. Account for object extents (half-sizes)
  4. Explain your calculations to the user
  5. Never guess object sizes
  6. Never place objects at arbitrary positions without bounds
目标是让对象放置直观且准确。始终:
  1. 使用可用的Unity MCP工具从组件中获取实际边界
  2. 计算世界空间位置
  3. 考虑对象的范围(半尺寸)
  4. 向用户解释你的计算过程
  5. 永远不要猜测对象大小
  6. 永远不要在没有边界信息的情况下将对象放置在任意位置