You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity反射探针:能否在探针外旋转Box投影边界黄色立方体?

How to Rotate Unity Reflection Probe's Box Projection Bounds (Yellow Cube)

Hey there! I totally get where you're coming from—this tripped me up too when I first worked with reflection probes. The short answer is: you can't rotate that yellow bounds cube using the Transform component, because it's not tied to the probe's Transform. Instead, it's controlled directly by properties on the ReflectionProbe component itself.

Why the Transform Doesn't Work

That yellow cube represents the probe's box projection bounds, which is a separate set of parameters (size, rotation, offset) from the probe's position/rotation in the scene. The Transform only moves the probe's origin point, but doesn't affect how the bounds are oriented.

Solutions to Rotate the Bounds

1. Manual Adjustment in the Inspector

If you just need a one-time rotation:

  • Select your Reflection Probe in the Hierarchy
  • In the Inspector, make sure Box Projection is enabled under the Projection settings
  • Look for the Box Rotation field (it might be tucked under a foldout labeled "Bounds" or directly visible once Box Projection is on)
  • You can either:
    • Enter Euler angle values directly into the X/Y/Z fields
    • Click the small "Edit Bounds" button next to the Box Size field, then use the rotation gizmo in the Scene View to spin the yellow cube interactively

2. Dynamic Rotation with Code

If you need to rotate the bounds during runtime, use the ReflectionProbe.boxRotation property. Here's a simple script example:

using UnityEngine;

public class RotateProbeBounds : MonoBehaviour
{
    [Tooltip("Assign your target Reflection Probe here")]
    public ReflectionProbe targetProbe;
    [Tooltip("Rotation speed in degrees per second")]
    public Vector3 rotationSpeed = new Vector3(0, 30, 0);

    void Update()
    {
        if (targetProbe == null) return;

        // Update the bounds rotation relative to its current orientation
        Quaternion newRotation = targetProbe.boxRotation * Quaternion.Euler(rotationSpeed * Time.deltaTime);
        targetProbe.boxRotation = newRotation;
    }
}

Just attach this script to any GameObject, assign your Reflection Probe to the targetProbe field, and adjust the rotation speed as needed.

Quick Notes

  • If your probe is set to Baked mode, rotating the bounds will require you to re-bake the reflection probes for changes to take effect
  • The boxRotation uses local space relative to the probe itself, not world space

内容的提问来源于stack exchange,提问作者Batuhan Tuğrul

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:16:23