open class Vector3(var x: Float, var y: Float, var z: Float)
Vector3
(
v
)
|
Constructor for creating a Vector3 with all components set to the same value.
Signature
constructor(v: Float) Parameters
v:
Float
Returns |
Vector3
(
c
)
|
Constructor for creating a Vector3 from a Color object.
Signature
constructor(c: Color) Parameters
c:
Color
Returns |
Vector3
(
x
, y
, z
)
|
Signature
constructor(x: Float, y: Float, z: Float) Parameters
x:
Float
y:
Float
z:
Float
Returns |
x
: Float
[Get][Set] |
Signature
open var x: Float |
y
: Float
[Get][Set] |
Signature
open var y: Float |
z
: Float
[Get][Set] |
Signature
open var z: Float |
add
(
v
)
| |
angleBetweenDegrees
(
v
)
|
Calculates the angle between two vectors in degrees.
Signature
fun angleBetweenDegrees(v: Vector3): Float Parameters Returns
Float
|
component1
()
|
Signature
operator fun component1(): Float Returns
Float
|
component2
()
|
Signature
operator fun component2(): Float Returns
Float
|
component3
()
|
Signature
operator fun component3(): Float Returns
Float
|
copy
()
| |
cross
(
other
)
| |
distanceTo
(
v
)
|
Calculates the distance between two vectors.
Signature
fun distanceTo(v: Vector3): Float Parameters Returns
Float
|
div
(
v
)
|
Divides a vector by a scalar.
Signature
inline operator fun div(v: Float): Vector3 Parameters
v:
Float
|
divide
(
v
)
|
Divides a vector by a scalar.
Signature
inline fun divide(v: Float): Vector3 Parameters
v:
Float
|
dot
(
v
)
|
Calculates the dot product of two vectors.
Signature
inline fun dot(v: Vector3): Float Parameters Returns
Float
|
equals
(
other
)
|
Signature
open operator override fun equals(other: Any?): Boolean Parameters
other:
Any?
Returns
Boolean
|
hashCode
()
|
Signature
open override fun hashCode(): Int Returns
Int
|
isWithinDistance
(
other
, distance
)
|
Checks if this position vector is within a specified Euclidean distance of another position vector.
This method uses squared distance internally for performance, avoiding a square root calculation. This is the recommended approach for position-based proximity checks in VR/AR applications.
Signature
fun isWithinDistance(other: Vector3, distance: Float): Boolean Parameters
distance:
Float
Returns
Boolean
|
length
()
|
Calculates the length (magnitude) of a vector.
Signature
fun length(): Float Returns
Float
|
lerp
(
dest
, ratio
)
|
Linearly interpolates between two vectors.
Signature
fun lerp(dest: Vector3, ratio: Float): Vector3 Parameters
ratio:
Float
|
max
(
v
)
| |
min
(
v
)
| |
minus
(
v
)
| |
multiply
(
v
)
| |
multiply
(
v
)
|
Multiplies a vector by a scalar.
Signature
inline fun multiply(v: Float): Vector3 Parameters
v:
Float
|
negate
()
| |
normalize
()
|
Normalizes a vector to have a length of 1
Signature
fun normalize(): Vector3 Returns
A new vector representing the normalization of this vector, or (0, 0, 0) if the length of this vector is 0.
|
plus
(
v
)
| |
setX
(
x
)
| |
setY
(
y
)
| |
setZ
(
z
)
| |
sub
(
v
)
| |
times
(
v
)
| |
times
(
v
)
|
Multiplies a vector by a scalar.
Signature
inline operator fun times(v: Float): Vector3 Parameters
v:
Float
|
toString
()
|
Returns a string representation of the vector.
Signature
open override fun toString(): String Returns
String
|
unaryMinus
()
|
Negates a vector.
Signature
inline operator fun unaryMinus(): Vector3 |