Skip to main content

Vector2

Complete API reference for Vector2, including constructors, attributes, virtual attributes, and methods.

Package: JAVARuntime

Category: Vector

Component: no


public class Vector2

Constructors

SignatureDescription
Vector2(Vector2)Executes Vector2 and returns after the underlying engine call finishes.
Vector2()Executes Vector2 and returns after the underlying engine call finishes.
Vector2(float, float)Creates a new instance of Vector2.
Vector2(int, float)Creates a new instance of Vector2.
Vector2(float, int)Creates a new instance of Vector2.
Vector2(int, int)Creates a new instance of Vector2.
Vector2(float)Creates a new instance of Vector2.

Attributes

NameTypeDescription
instanceVector2Represents the instance value stored on this instance. Read or assign to update the property.

Virtual Attributes

NameTypeAccessDescription
xfloatget/setReturns the X component of this Vector2.
yfloatget/setReturns the Y component of this Vector2.

Methods

SignatureReturnsDescription
mul(Vector2)Vector2Multiplies this Vector2 by the specified Vector2 and returns a new Vector2.
mul(float, float)Vector2Multiplies this Vector2 by the specified X and Y values and returns a new Vector2.
mul(float)Vector2Multiplies this Vector2 by the specified value and returns a new Vector2.
mulLocal(Vector3)voidMultiplies this Vector2 by the specified Vector3 (using only X and Y components) and updates this Vector2.
mulLocal(Vector2)voidMultiplies this Vector2 by the specified Vector2 and updates this Vector2.
mulLocal(float, float)voidMultiplies this Vector2 by the specified X and Y values and updates this Vector2.
mulLocal(float)voidMultiplies this Vector2 by the specified value and updates this Vector2.
multiply(Vector2)Vector2Multiplies this Vector2 by the specified Vector2 and returns a new Vector2.
multiply(float, float)Vector2Multiplies this Vector2 by the specified X and Y values and returns a new Vector2.
multiply(float)Vector2Multiplies this Vector2 by the specified value and returns a new Vector2.
div(Vector2)Vector2Divides this Vector2 by the specified Vector2 and returns a new Vector2.
div(float, float)Vector2Divides this Vector2 by the specified X and Y values and returns a new Vector2.
div(float)Vector2Divides this Vector2 by the specified value and returns a new Vector2.
divLocal(Vector3)voidDivides this Vector2 by the specified Vector3 (using only X and Y components) and updates this Vector2.
divLocal(Vector2)voidDivides this Vector2 by the specified Vector2 and updates this Vector2.
divLocal(float, float)voidDivides this Vector2 by the specified X and Y values and updates this Vector2.
divLocal(float)voidDivides this Vector2 by the specified value and updates this Vector2.
divide(Vector2)Vector2Divides this Vector2 by the specified Vector2 and returns a new Vector2.
divide(float, float)Vector2Divides this Vector2 by the specified X and Y values and returns a new Vector2.
divide(float)Vector2Divides this Vector2 by the specified value and returns a new Vector2.
sum(Vector2)Vector2Adds the specified Vector2 to this Vector2 and returns a new Vector2.
sum(float, float)Vector2Adds the specified X and Y values to this Vector2 and returns a new Vector2.
sum(float)Vector2Adds the specified value to this Vector2 and returns a new Vector2.
sumLocal(Vector3)voidAdds the specified Vector3 (using only X and Y components) to this Vector2 and updates this Vector2.
sumLocal(Vector2)voidAdds the specified Vector2 to this Vector2 and updates this Vector2.
sumLocal(float, float)voidAdds the specified X and Y values to this Vector2 and updates this Vector2.
sumLocal(float)voidAdds the specified value to this Vector2 and updates this Vector2.
add(Vector2)Vector2Adds the specified Vector2 to this Vector2 and returns a new Vector2.
add(float, float)Vector2Adds the specified X and Y values to this Vector2 and returns a new Vector2.
add(float)Vector2Adds the specified value to this Vector2 and returns a new Vector2.
sub(Vector2)Vector2Subtracts the specified Vector2 from this Vector2 and returns a new Vector2.
sub(float, float)Vector2Subtracts the specified X and Y values from this Vector2 and returns a new Vector2.
sub(float)Vector2Subtracts the specified value from this Vector2 and returns a new Vector2.
subLocal(Vector3)voidSubtracts the specified Vector3 (using only X and Y components) from this Vector2 and updates this Vector2.
subLocal(Vector2)voidSubtracts the specified Vector2 from this Vector2 and updates this Vector2.
subLocal(float, float)voidSubtracts the specified X and Y values from this Vector2 and updates this Vector2.
subLocal(float)voidSubtracts the specified value from this Vector2 and updates this Vector2.
subtract(Vector2)Vector2Subtracts the specified Vector2 from this Vector2 and returns a new Vector2.
subtract(float, float)Vector2Subtracts the specified X and Y values from this Vector2 and returns a new Vector2.
subtract(float)Vector2Subtracts the specified value from this Vector2 and returns a new Vector2.
equals(Vector2)booleanChecks if this Vector2 is equal to the specified Vector2.
equals(float, float)booleanChecks if this Vector2 is equal to the specified X and Y values.
equals(float)booleanChecks if all components of this Vector2 are equal to the specified value.
set(Vector2)voidSets the components of this Vector2 to the specified Vector2.
set(float, float)voidSets the components of this Vector2 to the specified X and Y values.
set(float)voidSets all components of this Vector2 to the specified value.
lerp(Vector2, float)voidInterpolates/smoothes between this Vector2 and the specified Vector2 based on the provided speed/interval and updates this Vector2.
lerp(float, float, float)voidInterpolates/smoothes between this Vector2 and the specified X and Y values based on the provided speed/interval and updates this Vector2.
lerp(float, float)voidInterpolates/smoothes between this Vector2 and the specified value based on the provided speed/interval and updates this Vector2.
lerpInSeconds(Vector2, float)voidInterpolates/smoothes between this Vector2 and the specified Vector2 based on the provided speed/interval in one second and updates this Vector2.
lerpInSeconds(float, float, float)voidInterpolates/smoothes between this Vector2 and the specified X and Y values based on the provided speed/interval in one second and updates this Vector2.
lerpInSeconds(float, float)voidInterpolates/smoothes between this Vector2 and the specified value based on the provided speed/interval in one second and updates this Vector2.
blend(Vector2, float)Vector2Blends between this Vector2 and the specified Vector2 based on the provided blend factor (0 to 1) and updates this Vector2.
blend(float, float, float)Vector2Blends between this Vector2 and the specified X and Y values based on the provided blend factor (0 to 1) and updates this Vector2.
blend(float, float)Vector2Blends between this Vector2 and the specified value based on the provided blend factor (0 to 1) and updates this Vector2.
blendLocal(Vector2, float)voidBlends between this Vector2 and the specified Vector2 based on the provided blend factor (0 to 1) and updates this Vector2.
blendLocal(float, float, float)voidBlends between this Vector2 and the specified X and Y values based on the provided blend factor (0 to 1) and updates this Vector2.
blendLocal(float, float)voidBlends between this Vector2 and the specified value based on the provided blend factor (0 to 1) and updates this Vector2.
normalize()Vector2Returns a normalized copy of this Vector2 (length equals 1).
normalizeLocal()voidNormalizes this Vector2 (sets its length to 1).
rotateLocal(float)voidRotates this Vector2 by the specified angle (in degrees) and updates this Vector2.
length()floatReturns the length (magnitude) of this Vector2.
sqrLength()floatReturns the squared length of this Vector2. Faster than length() as it doesn't use a square root; useful for comparing distances.
distance(Vector2)floatReturns the distance between this Vector2 and the specified Vector2.
sqrDistance(Vector2)floatReturns the squared distance between this Vector2 and the specified Vector2. Faster than distance() as it doesn't use a square root; useful for comparing distances.
dot(Vector2)floatReturns the dot product of this Vector2 and the specified Vector2.
dot(float, float)floatReturns the dot product of this Vector2 and the specified X and Y values.
dot(float)floatReturns the dot product of this Vector2 and the specified value, used for both components.
cross(Vector2)Vector3Returns the cross product of this Vector2 and the specified Vector2 as a Vector3.
cross(float, float)Vector3Returns the cross product of this Vector2 and the specified X and Y values as a Vector3.
copy()Vector2Returns a copy of this Vector2.
toString()StringReturns a String representation of this Vector2.
toString(int)StringReturns a String representation of this Vector2 with the specified number of decimal places.
equals(Object)booleanChecks if this Vector2 is equal to the specified object.
pointerEquals(Object)booleanChecks if this Vector2 is the same instance as the specified object.
notEquals(Object)booleanChecks if this Vector2 is not equal to the specified object.
greaterThan(Object)booleanChecks if this Vector2 is greater than the specified object (by magnitude).
greaterThan(float)booleanChecks if this Vector2 is greater than the specified value (by magnitude).
greaterThan(int)booleanChecks if this Vector2 is greater than the specified value (by magnitude).
greaterThan(long)booleanChecks if this Vector2 is greater than the specified value (by magnitude).
greaterThan(double)booleanChecks if this Vector2 is greater than the specified value (by magnitude).
greaterOrEqualsThan(Object)booleanChecks if this Vector2 is greater than or equal to the specified object (by magnitude).
greaterOrEqualsThan(float)booleanChecks if this Vector2 is greater than or equal to the specified value (by magnitude).
greaterOrEqualsThan(int)booleanChecks if this Vector2 is greater than or equal to the specified value (by magnitude).
greaterOrEqualsThan(long)booleanChecks if this Vector2 is greater than or equal to the specified value (by magnitude).
greaterOrEqualsThan(double)booleanChecks if this Vector2 is greater than or equal to the specified value (by magnitude).
lessThan(Object)booleanChecks if this Vector2 is less than the specified object (by magnitude).
lessThan(float)booleanChecks if this Vector2 is less than the specified value (by magnitude).
lessThan(int)booleanChecks if this Vector2 is less than the specified value (by magnitude).
lessThan(long)booleanChecks if this Vector2 is less than the specified value (by magnitude).
lessThan(double)booleanChecks if this Vector2 is less than the specified value (by magnitude).
lessOrEqualsThan(Object)booleanChecks if this Vector2 is less than or equal to the specified object (by magnitude).
lessOrEqualsThan(float)booleanChecks if this Vector2 is less than or equal to the specified value (by magnitude).
lessOrEqualsThan(int)booleanChecks if this Vector2 is less than or equal to the specified value (by magnitude).
lessOrEqualsThan(long)booleanChecks if this Vector2 is less than or equal to the specified value (by magnitude).
lessOrEqualsThan(double)booleanChecks if this Vector2 is less than or equal to the specified value (by magnitude).
sum(Object)TReturns the sum of this Vector2 and the specified object.
sumEqual(Object)voidSums the specified object to this Vector2.
div(Object)TReturns the division of this Vector2 by the specified object.
divEqual(Object)voidDivides this Vector2 by the specified object.
mul(Object)TReturns the multiplication of this Vector2 by the specified object.
mulEqual(Object)voidMultiplies this Vector2 by the specified object.
sub(Object)TReturns the subtraction of this Vector2 and the specified object.
subEqual(Object)voidSubtracts the specified object from this Vector2.
addAdd()voidIncrements this Vector2 by 1.
removeRemove()voidDecrements this Vector2 by 1.
serializeToString()StringReturns a String representation of this Vector2 in the format '[X;Y]'.
deserializeLocal(String)voidDeserializes a String in the format '[X;Y]' and sets the values to this Vector2.

Static Methods

SignatureReturnsDescription
genericInterface()GenericClassInspectorEntryExecutes genericInterface and returns after the underlying engine call finishes.
inspectorController()ClassInspectorEntryExecutes inspectorController and returns after the underlying engine call finishes.
zero()Vector2Returns a Vector2 with all components set to zero (0, 0).
rotateAroundPivot(Vector2, float)Vector2Rotates the specified Vector2 by the given angle (in degrees) and returns the result.
rotateAroundPivot(Vector2, Vector2, float)Vector2Rotates the specified Vector2 around the given pivot point by the specified angle (in degrees) and returns the result.
isNull(Object)booleanChecks if the specified object is null.