Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Vector2¶
使用浮点数坐标的 2D 向量。
Description¶
包含两个元素的结构体,可用于代表 2D 坐标或任何数值的二元组。
使用浮点数坐标。默认情况下,这些浮点值为 32 位精度,与始终为 64 位的 float 并不相同。如果需要双精度,请在编译引擎时使用 precision=double
选项。
对应的整数版本见 Vector2i。
注意:在布尔语境中,如果 Vector2 等于 Vector2(0, 0)
则求值结果为 false
。否则 Vector2 的求值结果始终为 true
。
Tutorials¶
Properties¶
|
||
|
Constructors¶
Vector2 ( ) |
|
Methods¶
abs ( ) const |
|
angle ( ) const |
|
angle_to_point ( Vector2 to ) const |
|
aspect ( ) const |
|
bezier_derivative ( Vector2 control_1, Vector2 control_2, Vector2 end, float t ) const |
|
bezier_interpolate ( Vector2 control_1, Vector2 control_2, Vector2 end, float t ) const |
|
ceil ( ) const |
|
cubic_interpolate ( Vector2 b, Vector2 pre_a, Vector2 post_b, float weight ) const |
|
cubic_interpolate_in_time ( Vector2 b, Vector2 pre_a, Vector2 post_b, float weight, float b_t, float pre_a_t, float post_b_t ) const |
|
direction_to ( Vector2 to ) const |
|
distance_squared_to ( Vector2 to ) const |
|
distance_to ( Vector2 to ) const |
|
floor ( ) const |
|
from_angle ( float angle ) static |
|
is_equal_approx ( Vector2 to ) const |
|
is_finite ( ) const |
|
is_normalized ( ) const |
|
is_zero_approx ( ) const |
|
length ( ) const |
|
length_squared ( ) const |
|