Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


operator -(Vector3, Vector3)

Subtracts one vector from another.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Operator
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static Vector3 operator -(Vector3 a, Vector3 b)

Parameters

The vector to subtract
b
from.

The vector to subtract from
a
.

Returns

Type

Description

Vector3

Remarks

Subtracts each component of
b
from
a
.

Examples

// prints (-5.0,-3.0,-1.0)using UnityEngine;using System.Collections;public class ExampleClass : MonoBehaviour{ void Example() { print(new Vector3(1, 2, 3) - new Vector3(6, 5, 4)); }}