struct

Godot::Vector3

Inherits Struct < Value < Object

3-element structure that can be used to represent 3D coordinates or vectors with 32-bit floating point precision.

Constants

BACK = Vector3.new(0.0_f32, 0.0_f32, 1.0_f32)
DOWN = Vector3.new(0.0_f32, -1.0_f32, 0.0_f32)
FORWARD = Vector3.new(0.0_f32, 0.0_f32, -1.0_f32)
INF = Vector3.new(Float32::INFINITY, Float32::INFINITY, Float32::INFINITY)
LEFT = Vector3.new(-1.0_f32, 0.0_f32, 0.0_f32)
ONE = Vector3.new(1.0_f32, 1.0_f32, 1.0_f32)
RIGHT = Vector3.new(1.0_f32, 0.0_f32, 0.0_f32)
UP = Vector3.new(0.0_f32, 1.0_f32, 0.0_f32)
ZERO = Vector3.new(0.0_f32, 0.0_f32, 0.0_f32)

Common constants

Constructors

new(x : Float32 = 0.0_f32, y : Float32 = 0.0_f32, z : Float32 = 0.0_f32)
Source
new(x : Number, y : Number, z : Number)
Source

Instance methods

*(scalar : Number) : Vector3
Source
*(other : Vector3) : Vector3
Source
+(other : Vector3) : Vector3
Source
-(other : Vector3) : Vector3
Source
/(scalar : Number) : Vector3
Source
/(other : Vector3) : Vector3
Source
angle_to(to : Vector3) : Float32

Returns the unsigned angle in radians between this vector and other.

Source
bounce(normal : Vector3) : Vector3

Returns a new vector bounced off a plane defined by the given normal.

Source
ceil
Source
clamp(min : Vector3, max : Vector3) : Vector3

Clamps each component between min and max.

Source
cross(other : Vector3) : Vector3
Source
direction_to(other : Vector3) : Vector3

Returns the normalized direction from this vector toward other.

Source
distance_squared_to(other : Vector3) : Float32

Returns the squared distance between this vector and other.

Source
distance_to(other : Vector3) : Float32

Returns the distance between this vector and other.

Source
dot(other : Vector3) : Float32
Source
floor
Source
is_equal_approx(other : Vector3) : Bool
Source
is_normalized?
Source
is_zero_approx
Source
length
Source
length_squared
Source
lerp(to : Vector3, weight : Number) : Vector3

Linearly interpolates between this vector and to by weight.

Source
limit_length(max_length : Number = 1.0) : Vector3

Clamps the vector's length to max_length.

Source
max(other : Vector3) : Vector3
Source
min(other : Vector3) : Vector3
Source
move_toward(to : Vector3, delta : Number) : Vector3

Moves this vector toward to by the given delta amount, never exceeding to.

Source
normalized
Source
project(b : Vector3) : Vector3

Projects this vector onto vector b.

Source
reflect(normal : Vector3) : Vector3

Returns a new vector reflected from a plane defined by the given normal.

Source
rotated(axis : Vector3, angle : Number) : Vector3

Rotates this vector around the given axis by the given angle in radians. Uses Rodrigues' rotation formula.

Source
round
Source
sign
Source
signed_angle_to(to : Vector3, axis : Vector3) : Float32

Returns the signed angle in radians between this vector and other with respect to the given axis.

Source
slerp(to : Vector3, weight : Number) : Vector3

Spherically interpolates between this vector and to by weight.

Source
slide(normal : Vector3) : Vector3

Returns a new vector slid along a plane defined by the given normal vector. Normal must be normalized.

Source
to_i
Source
to_s(io : IO) : Void

Same as #inspect(io).

Source
x=(x : Float32)
Source
y=(y : Float32)
Source
z=(z : Float32)
Source