Version: 5.4 (switch to 5.5b)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


struct in UnityEngine

Suggest a change


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.


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.





3D ベクトルと位置の表現

この構造体は Unity 全体の 3D での位置や方向のために使用されています。 一般的なベクトル演算を行うための関数が含まれています。

下記のリストにある機能は、他のクラスでベクトルや位置を操作するために使用することができます。 例えば、QuaternionMatrix4x4 クラスでは、回転したり、ベクトルと位置の変換をするのに便利です。

Static Variables

backShorthand for writing Vector3(0, 0, -1).
downShorthand for writing Vector3(0, -1, 0).
forwardShorthand for writing Vector3(0, 0, 1).
leftShorthand for writing Vector3(-1, 0, 0).
oneShorthand for writing Vector3(1, 1, 1).
rightShorthand for writing Vector3(1, 0, 0).
upShorthand for writing Vector3(0, 1, 0).
zeroShorthand for writing Vector3(0, 0, 0).


magnitudeReturns the length of this vector (Read Only).
normalizedReturns this vector with a magnitude of 1 (Read Only).
sqrMagnitudeReturns the squared length of this vector (Read Only).
this[int]Access the x, y, z components using [0], [1], [2] respectively.
xX component of the vector.
yY component of the vector.
zZ component of the vector.


Vector3与えられた x、y、z 成分で新規のベクトルを作成します

Public Functions

SetSet x, y and z components of an existing Vector3.
ToStringReturns a nicely formatted string for this vector.

Static Functions

AngleReturns the angle in degrees between from and to.
ClampMagnitudeReturns a copy of vector with its magnitude clamped to maxLength.
CrossCross Product of two vectors.
DistanceReturns the distance between a and b.
DotDot Product of two vectors.
Lerp直線上にある 2 つのベクトル間を補間します
LerpUnclamped直線上にある 2 つのベクトル間を補間します
MaxReturns a vector that is made from the largest components of two vectors.
MinReturns a vector that is made from the smallest components of two vectors.
MoveTowards現在の位置 current から target に向けて移動します
ProjectProjects a vector onto another vector.
ProjectOnPlaneProjects a vector onto a plane defined by a normal orthogonal to the plane.
ReflectReflects a vector off the plane defined by a normal.
RotateTowards現在の位置 current から target に向けてベクトルを回転します。
ScaleMultiplies two vectors component-wise.
Slerp球状に 2 つのベクトル間を補間します
SlerpUnclamped球状に 2 つのベクトル間を補間します
SmoothDampGradually changes a vector towards a desired goal over time.


operator -Subtracts one vector from another.
operator !=Returns true if vectors different.
operator *Multiplies a vector by a number.
operator /Divides a vector by a number.
operator +Adds two vectors.
operator ==Returns true if the vectors are equal.