Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Bounds.IntersectRay

フィードバック

ありがとうございます

この度はドキュメントの品質向上のためにご意見・ご要望をお寄せいただき、誠にありがとうございます。頂いた内容をドキュメントチームで確認し、必要に応じて修正を致します。

閉じる

送信に失敗しました

なんらかのエラーが発生したため送信が出来ませんでした。しばらく経ってから<a>もう一度送信</a>してください。ドキュメントの品質向上のために時間を割いて頂き誠にありがとうございます。

閉じる

キャンセル

マニュアルに切り替える
public function IntersectRay(ray: Ray): bool;
public bool IntersectRay(Ray ray);

パラメーター

説明

ray が交差しているか確認します

// Function to detect if a ray (representing a beam weapon, say)
// makes contact with the collider's bounds.

var coll: Collider;

function Start() { // Store a reference to the collider once at startup. coll = GetComponent.<Collider>(); }

function DetectHit(ray: Ray) { return coll.bounds.IntersectRay(ray); }
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Collider coll; void Start() { coll = GetComponent<Collider>(); } bool DetectHit(Ray ray) { return coll.bounds.IntersectRay(ray); } }

public function IntersectRay(ray: Ray, out distance: float): bool;
public bool IntersectRay(Ray ray, out float distance);

パラメーター

説明

ray が交差しているか確認します

関数が true を返すとき、レイの原点に対する距離は distance パラメーターとして返されます。