Added non-static looking_at and from_scale helper methods to Basis.

This commit is contained in:
Relintai 2024-09-30 16:27:21 +02:00
parent 6ac0c2bbc0
commit 010e1b51a8
2 changed files with 10 additions and 0 deletions

View File

@ -239,6 +239,13 @@ Basis Basis::create_from_scale(const Vector3 &p_scale) {
return Basis(p_scale.x, 0, 0, 0, p_scale.y, 0, 0, 0, p_scale.z);
}
Basis Basis::looking_at(const Vector3 &p_target, const Vector3 &p_up) {
return Basis::create_looking_at(p_target, p_up);
}
Basis Basis::from_scale(const Vector3 &p_scale) {
return Basis::create_from_scale(p_scale);
}
// Multiplies the matrix from left by the scaling matrix: M -> S.M
// See the comment for Basis::rotated for further explanation.
void Basis::scale(const Vector3 &p_scale) {

View File

@ -289,6 +289,9 @@ struct _NO_DISCARD_CLASS_ Basis {
static Basis create_looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0));
static Basis create_from_scale(const Vector3 &p_scale);
Basis looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0));
Basis from_scale(const Vector3 &p_scale);
operator Quaternion() const { return get_quaternion(); }
Basis(const Quaternion &p_quat) { set_quaternion(p_quat); }