mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #109744 from Repiteo/core/math-constants-semantic
Core: Integrate semantic constants in math structs
This commit is contained in:
commit
c39edeca6d
16 changed files with 192 additions and 123 deletions
|
|
@ -1482,8 +1482,8 @@ void Node3D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("orthonormalize"), &Node3D::orthonormalize);
|
||||
ClassDB::bind_method(D_METHOD("set_identity"), &Node3D::set_identity);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("look_at", "target", "up", "use_model_front"), &Node3D::look_at, DEFVAL(Vector3(0, 1, 0)), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("look_at_from_position", "position", "target", "up", "use_model_front"), &Node3D::look_at_from_position, DEFVAL(Vector3(0, 1, 0)), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("look_at", "target", "up", "use_model_front"), &Node3D::look_at, DEFVAL(Vector3::UP), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("look_at_from_position", "position", "target", "up", "use_model_front"), &Node3D::look_at_from_position, DEFVAL(Vector3::UP), DEFVAL(false));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("to_local", "global_point"), &Node3D::to_local);
|
||||
ClassDB::bind_method(D_METHOD("to_global", "local_point"), &Node3D::to_global);
|
||||
|
|
|
|||
|
|
@ -321,8 +321,8 @@ public:
|
|||
void global_scale(const Vector3 &p_scale);
|
||||
void global_translate(const Vector3 &p_offset);
|
||||
|
||||
void look_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false);
|
||||
void look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false);
|
||||
void look_at(const Vector3 &p_target, const Vector3 &p_up = Vector3::UP, bool p_use_model_front = false);
|
||||
void look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up = Vector3::UP, bool p_use_model_front = false);
|
||||
|
||||
Vector3 to_local(Vector3 p_global) const;
|
||||
Vector3 to_global(Vector3 p_local) const;
|
||||
|
|
|
|||
|
|
@ -84,10 +84,8 @@ bool SpringBoneCollisionCapsule3D::is_inside() const {
|
|||
}
|
||||
|
||||
Pair<Vector3, Vector3> SpringBoneCollisionCapsule3D::get_head_and_tail(const Transform3D &p_center) const {
|
||||
static const Vector3 VECTOR3_UP = Vector3(0, 1, 0);
|
||||
static const Vector3 VECTOR3_DOWN = Vector3(0, -1, 0);
|
||||
Transform3D tr = get_transform_from_skeleton(p_center);
|
||||
return Pair<Vector3, Vector3>(tr.origin + tr.basis.xform(VECTOR3_UP * (height * 0.5 - radius)), tr.origin + tr.basis.xform(VECTOR3_DOWN * (height * 0.5 - radius)));
|
||||
return Pair<Vector3, Vector3>(tr.origin + tr.basis.xform(Vector3::UP * (height * 0.5 - radius)), tr.origin + tr.basis.xform(Vector3::DOWN * (height * 0.5 - radius)));
|
||||
}
|
||||
|
||||
void SpringBoneCollisionCapsule3D::_bind_methods() {
|
||||
|
|
|
|||
|
|
@ -31,10 +31,9 @@
|
|||
#include "spring_bone_collision_plane_3d.h"
|
||||
|
||||
Vector3 SpringBoneCollisionPlane3D::_collide(const Transform3D &p_center, float p_bone_radius, float p_bone_length, const Vector3 &p_current) const {
|
||||
static const Vector3 VECTOR3_UP = Vector3(0, 1, 0);
|
||||
Transform3D tr = get_transform_from_skeleton(p_center);
|
||||
Vector3 pos = tr.origin;
|
||||
Vector3 normal = tr.basis.get_rotation_quaternion().xform(VECTOR3_UP);
|
||||
Vector3 normal = tr.basis.get_rotation_quaternion().xform(Vector3::UP);
|
||||
Vector3 to_vec = p_current - pos;
|
||||
float distance = to_vec.dot(normal) - p_bone_radius;
|
||||
if (distance > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue