Vector2.operator - 运算符 减法

static operator - (a : Vector2, b : Vector2) : Vector2

Description描述

Subtracts one vector from another.

一个向量减去另一个向量。

Subtracts each component of b from a.

从a的对应的每个组件减b对应的每个组件。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(new Vector2(1, 2) - new Vector2(3, 2));
	}
}
// prints (-2.0,0.0)
print (Vector2(1,2) - Vector2(3,2));

static operator - (a : Vector2) : Vector2

Description描述

Negates a vector.

向量求反

Each component in the result is negated.

结果是每个组件是取它相反数。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(-new Vector2(1, 2));
	}
}
// prints (-1.0,-2.0)
print (-Vector2(1,2));
Page last updated: 2011-1-4