BoundsConstructor

切换到手册
public Bounds (Vector3 center, Vector3 size);

参数

centerBounds 的原点位置。
sizeBounds 的尺寸。

描述

创建一个新的 Bounds。

创建一个新的具有给定中心和总大小的 Bounds。边界范围 将是给定大小的一半。

// Create bounding box centered at the origin
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour { Bounds b;

void Start() { b = new Bounds(new Vector3(0, 0, 0), new Vector3(1, 2, 1)); } }

在没有为构造函数提供参数时,创建的 Bounds 的 中心为 (0,0,0),范围为 (0,0,0)。

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961