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

スクリプト言語

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

Plane.SetNormalAndPosition

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 function SetNormalAndPosition(inNormal: Vector3, inPoint: Vector3): void;
public void SetNormalAndPosition(Vector3 inNormal, Vector3 inPoint);
public def SetNormalAndPosition(inNormal as Vector3, inPoint as Vector3) as void

Parameters

inNormal 平面の法線ベクトル
inPoint 平面の法線ベクトル

Description

ベクトルの法線と地点により平面を設定します

法線は 正規化されたベクトル である必要があることに留意して下さい。

var fieldLength: float;
var fieldWidth: float;
var goalLine1: Plane;
var goalLine2: Plane;
var leftSideLine: Plane;
var rightSideLine: Plane;

function Start () {	
	// Set up goal lines of a playing field.
	goalLine1.SetNormalAndPosition(Vector3.forward, Vector3.forward * fieldLength / 2);
	goalLine1.SetNormalAndPosition(-Vector3.forward, -Vector3.forward * fieldLength / 2);
	
	// Set up side lines.
	leftSideLine.SetNormalAndPosition(-Vector3.right, -Vector3.right * fieldWidth / 2);
	leftSideLine.SetNormalAndPosition(Vector3.right, Vector3.right * fieldWidth / 2);
}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public float fieldLength;
    public float fieldWidth;
    public Plane goalLine1;
    public Plane goalLine2;
    public Plane leftSideLine;
    public Plane rightSideLine;
    void Start() {
        goalLine1.SetNormalAndPosition(Vector3.forward, Vector3.forward * fieldLength / 2);
        goalLine1.SetNormalAndPosition(-Vector3.forward, -Vector3.forward * fieldLength / 2);
        leftSideLine.SetNormalAndPosition(-Vector3.right, -Vector3.right * fieldWidth / 2);
        leftSideLine.SetNormalAndPosition(Vector3.right, Vector3.right * fieldWidth / 2);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public fieldLength as float

	public fieldWidth as float

	public goalLine1 as Plane

	public goalLine2 as Plane

	public leftSideLine as Plane

	public rightSideLine as Plane

	def Start() as void:
		goalLine1.SetNormalAndPosition(Vector3.forward, ((Vector3.forward * fieldLength) / 2))
		goalLine1.SetNormalAndPosition(-Vector3.forward, (((-Vector3.forward) * fieldLength) / 2))
		leftSideLine.SetNormalAndPosition(-Vector3.right, (((-Vector3.right) * fieldWidth) / 2))
		leftSideLine.SetNormalAndPosition(Vector3.right, ((Vector3.right * fieldWidth) / 2))

See Also: Set3Points.