Vector3 Structure |
Namespace: Godot
[SerializableAttribute] public struct Vector3 : IEquatable<Vector3>
The Vector3 type exposes the following members.
Name | Description | |
---|---|---|
Vector3(Vector3) |
Constructs a new Vector3 from an existing Vector3.
| |
Vector3(Single, Single, Single) |
Constructs a new Vector3 with the given components.
|
Name | Description | |
---|---|---|
Back |
Back unit vector. Represents the local direction of back,
and the global direction of south.
| |
Down |
Down unit vector.
| |
Forward |
Forward unit vector. Represents the local direction of forward,
and the global direction of north.
| |
Inf |
Infinity vector, a vector with all components set to `Mathf.Inf`.
| |
Item |
Access vector components using their index.
| |
Left |
Left unit vector. Represents the local direction of left,
and the global direction of west.
| |
NegOne |
Deprecated, please use a negative sign with One instead.
| |
One |
One vector, a vector with all components set to `1`.
| |
Right |
Right unit vector. Represents the local direction of right,
and the global direction of east.
| |
Up |
Up unit vector.
| |
Zero |
Zero vector, a vector with all components set to `0`.
|
Name | Description | |
---|---|---|
Abs |
Returns a new vector with all components in absolute values (i.e. positive).
| |
AngleTo |
Returns the minimum angle to the given vector, in radians.
| |
Bounce |
Returns this vector "bounced off" from a plane defined by the given normal.
| |
Ceil |
Returns a new vector with all components rounded up (towards positive infinity).
| |
Cross |
Returns the cross product of this vector and `b`.
| |
CubicInterpolate |
Performs a cubic interpolation between vectors `preA`, this vector,
`b`, and `postB`, by the given amount `t`.
| |
DirectionTo |
Returns the normalized vector pointing from this vector to `b`.
| |
DistanceSquaredTo |
Returns the squared distance between this vector and `b`.
This method runs faster than DistanceTo(Vector3), so prefer it if
you need to compare vectors or need the squared distance for some formula.
| |
DistanceTo |
Returns the distance between this vector and `b`.
| |
Dot |
Returns the dot product of this vector and `b`.
| |
Equals(Object) | (Overrides ValueTypeEquals(Object).) | |
Equals(Vector3) | ||
Floor |
Returns a new vector with all components rounded down (towards negative infinity).
| |
GetHashCode | (Overrides ValueTypeGetHashCode.) | |
GetType | (Inherited from Object.) | |
Inverse |
Returns the inverse of this vector. This is the same as `new Vector3(1 / v.x, 1 / v.y, 1 / v.z)`.
| |
IsEqualApprox |
Returns true if this vector and `other` are approximately equal, by running
IsEqualApprox(Single, Single) on each component.
| |
IsNormalized |
Returns true if the vector is normalized, and false otherwise.
| |
Length |
Returns the length (magnitude) of this vector.
| |
LengthSquared |
Returns the squared length (squared magnitude) of this vector.
This method runs faster than Length, so prefer it if
you need to compare vectors or need the squared length for some formula.
| |
LinearInterpolate(Vector3, Vector3) |
Returns the result of the linear interpolation between
this vector and `to` by the vector amount `weight`.
| |
LinearInterpolate(Vector3, Single) |
Returns the result of the linear interpolation between
this vector and `to` by amount `weight`.
| |
MaxAxis |
Returns the axis of the vector's largest value. See Vector3Axis.
If all components are equal, this method returns X.
| |
MinAxis |
Returns the axis of the vector's smallest value. See Vector3Axis.
If all components are equal, this method returns Z.
| |
MoveToward |
Moves this vector toward `to` by the fixed `delta` amount.
| |
Normalized |
Returns the vector scaled to unit length. Equivalent to `v / v.Length()`.
| |
Outer |
Returns the outer product with `b`.
| |
PosMod(Single) |
Returns a vector composed of the PosMod(Single, Single) of this vector's components and `mod`.
| |
PosMod(Vector3) |
Returns a vector composed of the PosMod(Single, Single) of this vector's components and `modv`'s components.
| |
Project |
Returns this vector projected onto another vector `b`.
| |
Reflect |
Returns this vector reflected from a plane defined by the given `normal`.
| |
Rotated |
Rotates this vector around a given `axis` vector by `phi` radians.
The `axis` vector must be a normalized vector.
| |
Round |
Returns this vector with all components rounded to the nearest integer,
with halfway cases rounded towards the nearest multiple of two.
| |
Set(Vector3) | Obsolete. | |
Set(Single, Single, Single) | Obsolete. | |
Sign |
Returns a vector with each component set to one or negative one, depending
on the signs of this vector's components, or zero if the component is zero,
by calling Sign(Single) on each component.
| |
Slerp |
Returns the result of the spherical linear interpolation between
this vector and `to` by amount `weight`.
Note: Both vectors must be normalized.
| |
Slide |
Returns this vector slid along a plane defined by the given normal.
| |
Snapped |
Returns this vector with each component snapped to the nearest multiple of `step`.
This can also be used to round to an arbitrary number of decimals.
| |
ToDiagonalMatrix |
Returns a diagonal matrix with the vector as main diagonal.
This is equivalent to a Basis with no rotation or shearing and
this vector's components set as the scale.
| |
ToString | (Overrides ValueTypeToString.) | |
ToString(String) |
Name | Description | |
---|---|---|
x |
The vector's X component. Also accessible by using the index position `[0]`.
| |
y |
The vector's Y component. Also accessible by using the index position `[1]`.
| |
z |
The vector's Z component. Also accessible by using the index position `[2]`.
|