言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Mathf.Infinity

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static var Infinity: float;
public static float Infinity;
public static Infinity as float

Description

無限大を表現します (Read Only)

	// 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
 
	function 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!");
		}
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        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!");
        
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		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!')