Version: 2023.2
public static float Infinity ;

描述

正无穷大的表示形式(只读)。

using UnityEngine;

public class Example : MonoBehaviour { // Casts a ray from (0,0,0) towards (0,0,1) to the infinity and prints a message // if any object has touched the ray. // To test it, just place any object and intersect it with the white drawn line

void Update() { // shows the line that follows the ray. Debug.DrawLine(Vector3.zero, Vector3.forward * 100); if (Physics.Raycast(Vector3.zero, Vector3.forward, Mathf.Infinity)) { print("There is something in front of the object!"); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961