mirror of
https://github.com/godotengine/godot.git
synced 2025-02-17 22:43:01 +08:00
Merge pull request #30788 from Chaosus/direction_to_gdnative
Added Vector2/3.direction_to methods to GDNative
This commit is contained in:
commit
140e7e5edf
@ -77,6 +77,14 @@ godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self) {
|
|||||||
return self->is_normalized();
|
return self->is_normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
godot_vector2 GDAPI godot_vector2_direction_to(const godot_vector2 *p_self, const godot_vector2 *p_to) {
|
||||||
|
godot_vector2 dest;
|
||||||
|
const Vector2 *self = (const Vector2 *)p_self;
|
||||||
|
const Vector2 *to = (const Vector2 *)p_to;
|
||||||
|
*((Vector2 *)&dest) = self->direction_to(*to);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to) {
|
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to) {
|
||||||
const Vector2 *self = (const Vector2 *)p_self;
|
const Vector2 *self = (const Vector2 *)p_self;
|
||||||
const Vector2 *to = (const Vector2 *)p_to;
|
const Vector2 *to = (const Vector2 *)p_to;
|
||||||
|
@ -182,6 +182,14 @@ godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self) {
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
godot_vector3 GDAPI godot_vector3_direction_to(const godot_vector3 *p_self, const godot_vector3 *p_to) {
|
||||||
|
godot_vector3 dest;
|
||||||
|
const Vector3 *self = (const Vector3 *)p_self;
|
||||||
|
const Vector3 *to = (const Vector3 *)p_to;
|
||||||
|
*((Vector3 *)&dest) = self->direction_to(*to);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b) {
|
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b) {
|
||||||
const Vector3 *self = (const Vector3 *)p_self;
|
const Vector3 *self = (const Vector3 *)p_self;
|
||||||
const Vector3 *b = (const Vector3 *)p_b;
|
const Vector3 *b = (const Vector3 *)p_b;
|
||||||
|
@ -64,6 +64,22 @@
|
|||||||
["godot_int", "p_from"],
|
["godot_int", "p_from"],
|
||||||
["godot_int", "p_to"]
|
["godot_int", "p_to"]
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "godot_vector3_direction_to",
|
||||||
|
"return_type": "godot_vector3",
|
||||||
|
"arguments": [
|
||||||
|
["const godot_vector3 *", "p_self"],
|
||||||
|
["const godot_vector3 *", "p_to"]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "godot_vector2_direction_to",
|
||||||
|
"return_type": "godot_vector2",
|
||||||
|
"arguments": [
|
||||||
|
["const godot_vector2 *", "p_self"],
|
||||||
|
["const godot_vector2 *", "p_to"]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -71,6 +71,8 @@ godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self);
|
|||||||
|
|
||||||
godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self);
|
godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self);
|
||||||
|
|
||||||
|
godot_vector2 GDAPI godot_vector2_direction_to(const godot_vector2 *p_self, const godot_vector2 *p_b);
|
||||||
|
|
||||||
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to);
|
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to);
|
||||||
|
|
||||||
godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to);
|
godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to);
|
||||||
|
@ -106,6 +106,8 @@ godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self);
|
|||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self);
|
godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self);
|
||||||
|
|
||||||
|
godot_vector3 GDAPI godot_vector3_direction_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
||||||
|
Loading…
Reference in New Issue
Block a user