struct
Godot::Vector3
- Godot::Vector3
- Struct
- Value
- Object
Overview
3-element structure that can be used to represent 3D coordinates or vectors with 32-bit floating point precision.
Defined in:
libgodot/types/vector3.crConstant Summary
-
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) -
MODEL_BOTTOM =
Vector3.new(0.0_f32, -1.0_f32, 0.0_f32) -
MODEL_FRONT =
Vector3.new(0.0_f32, 0.0_f32, -1.0_f32) -
MODEL_LEFT =
Vector3.new(-1.0_f32, 0.0_f32, 0.0_f32) -
MODEL_REAR =
Vector3.new(0.0_f32, 0.0_f32, 1.0_f32) -
MODEL_RIGHT =
Vector3.new(1.0_f32, 0.0_f32, 0.0_f32) -
MODEL_TOP =
Vector3.new(0.0_f32, 1.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)
- .new(x : Number, y : Number, z : Number)
- .new(pointer : Pointer(Void))
Instance Method Summary
- #!=(other : Vector3) : Bool
- #*(scalar : Number) : Vector3
- #*(other : Vector3) : Vector3
- #+(other : Vector3) : Vector3
- #-(other : Vector3) : Vector3
- #- : Vector3
- #/(scalar : Number) : Vector3
- #/(other : Vector3) : Vector3
- #==(other : Vector3) : Bool
- #abs : Vector3
-
#angle_to(to : Vector3) : Float32
Returns the unsigned angle in radians between this vector and other.
-
#bezier_interpolate(control_1 : Vector3, control_2 : Vector3, end_point : Vector3, t : Number) : Vector3
Bezier interpolation through control points.
-
#bounce(normal : Vector3) : Vector3
Returns a new vector bounced off a plane defined by the given normal.
- #ceil : Vector3
-
#clamp(min : Vector3, max : Vector3) : Vector3
Clamps each component between min and max.
-
#clampf(min_val : Number, max_val : Number) : Vector3
Clamps each component between scalar min and max values.
- #cross(other : Vector3) : Vector3
-
#cubic_interpolate(b : Vector3, pre_a : Vector3, post_b : Vector3, weight : Number) : Vector3
Cubic interpolation between two vectors using pre_a and post_b tangents.
-
#direction_to(other : Vector3) : Vector3
Returns the normalized direction from this vector toward other.
-
#distance_squared_to(other : Vector3) : Float32
Returns the squared distance between this vector and other.
-
#distance_to(other : Vector3) : Float32
Returns the distance between this vector and other.
- #dot(other : Vector3) : Float32
- #floor : Vector3
- #is_equal_approx(other : Vector3) : Bool
- #is_finite? : Bool
- #is_normalized? : Bool
- #is_zero_approx : Bool
- #is_zero_approx? : Bool
- #length : Float32
- #length_squared : Float32
-
#lerp(to : Vector3, weight : Number) : Vector3
Linearly interpolates between this vector and to by weight.
-
#limit_length(max_length : Number = 1.0) : Vector3
Clamps the vector's length to max_length.
- #max(other : Vector3) : Vector3
- #min(other : Vector3) : Vector3
-
#move_toward(to : Vector3, delta : Number) : Vector3
Moves this vector toward to by the given delta amount, never exceeding to.
- #normalized : Vector3
-
#posmod(mod_val : Number) : Vector3
Returns the vector with each component modulo scalar.
-
#project(b : Vector3) : Vector3
Projects this vector onto vector b.
-
#reflect(normal : Vector3) : Vector3
Returns a new vector reflected from a plane defined by the given normal.
-
#rotated(axis : Vector3, angle : Number) : Vector3
Rotates this vector around the given axis by the given angle in radians.
- #round : Vector3
- #sign : Vector3
-
#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.
-
#slerp(to : Vector3, weight : Number) : Vector3
Spherically interpolates between this vector and to by weight.
-
#slide(normal : Vector3) : Vector3
Returns a new vector slid along a plane defined by the given normal vector.
-
#snapped(step : Vector3) : Vector3
Snaps vector components to nearest multiple of step.
- #to_i : Vector3i
-
#to_s(io : IO) : Void
Same as
#inspect(io). - #x : Float32
- #x=(x : Float32)
- #xy : Vector2
- #xz : Vector2
- #y : Float32
- #y=(y : Float32)
- #yz : Vector2
- #z : Float32
- #z=(z : Float32)
Constructor Detail
Instance Method Detail
Returns the unsigned angle in radians between this vector and other.
Bezier interpolation through control points.
Returns a new vector bounced off a plane defined by the given normal.
Clamps each component between scalar min and max values.
Cubic interpolation between two vectors using pre_a and post_b tangents.
Returns the normalized direction from this vector toward other.
Returns the squared distance between this vector and other.
Linearly interpolates between this vector and to by weight.
Moves this vector toward to by the given delta amount, never exceeding to.
Returns a new vector reflected from a plane defined by the given normal.
Rotates this vector around the given axis by the given angle in radians.
Returns the signed angle in radians between this vector and other with respect to the given axis.
Spherically interpolates between this vector and to by weight.
Returns a new vector slid along a plane defined by the given normal vector.