Version: 5.4

Vector2

struct in UnityEngine

Switch to Manual

Description

Представление 2D vector'ов и точек.

This structure is used in some places to represent 2D positions and vectors (e.g. texture coordinates in a Mesh or texture offsets in Material). In the majority of other cases a Vector3 is used.

Static Variables

downShorthand for writing Vector2(0, -1).
leftShorthand for writing Vector2(-1, 0).
oneСокращенное написание Vector2(1,1)
rightСокращенное написание Vector2(1,0)
upСокращение написания Vector2(0,1)
zeroСокращенное написание Vector2(0,0)

Variables

magnitudeВозвращает длину этого vector'a
normalizedReturns this vector with a magnitude of 1 (Read Only).
sqrMagnitudeВозвращает квадрат длины этого vector'a (Read Only)
this[int]Доступ к x или y компонентам используются [0] или [1] соответственно
xX компонент вектора.
yY компонент вектора.

Constructors

Vector2Создает новый вектор с заданными х, у данными

Public Functions

NormalizeMakes this vector have a magnitude of 1.
SetSet x and y components of an existing Vector2.
ToStringВозвращает отформатированной строки для этого вектора

Static Functions

AngleReturns the angle in degrees between from and to.
ClampMagnitudeReturns a copy of vector with its magnitude clamped to maxLength.
DistanceВозвращает длину между а и /b/
DotDot Product of two vectors.
LerpLinearly interpolates between vectors a and b by t.
LerpUnclampedLinearly interpolates between vectors a and b by t.
MaxВозвращает vector, который сделан из компонентов двух vector'oв
MinReturns a vector that is made from the smallest components of two vectors.
MoveTowardsПеремещает из точки curren в /target /
ReflectReflects a vector off the vector defined by a normal.
ScaleПокомпонентное умножение двух vector'oв
SmoothDampGradually changes a vector towards a desired goal over time.

Operators

operator -Вычитает один vector из другого
operator !=Возвращает истину, если vector отличается
operator *Умножает vector на число
operator /Делит vector на число
operator +Добавляет два вектора.
operator ==Возвращает истину, если vector'ы равны
Vector2Конвертировать Vector3 в Vector2
Vector3Конвертирует Vector2 в Vector3.