From 47e5b44576e581ae0b62ad1e3bed444b8a82cefd Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 10 Jan 2025 15:35:23 +0100 Subject: spawn ui in world with click --- client/src/camera.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'client/src/camera.rs') diff --git a/client/src/camera.rs b/client/src/camera.rs index f5a911b..9228482 100644 --- a/client/src/camera.rs +++ b/client/src/camera.rs @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -use glam::{EulerRot, Mat3, Mat4, Vec2, Vec3, vec3}; +use glam::{Affine3A, EulerRot, Mat3, Mat4, Vec2, Vec3, vec3}; pub struct Camera { pos: Vec3, @@ -45,4 +45,10 @@ impl Camera { * Mat4::from_mat3(self.rotation_mat().inverse()) * Mat4::from_translation(-self.pos) } + pub fn new_ui_affine(&self) -> Affine3A { + Affine3A::from_mat3_translation( + self.rotation_mat(), + self.pos + self.rotation_mat() * vec3(0., 0., -3.), + ) + } } -- cgit v1.2.3-70-g09d2