diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-10 15:35:23 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-10 15:35:23 +0100 |
commit | 47e5b44576e581ae0b62ad1e3bed444b8a82cefd (patch) | |
tree | dc669acc78003dc9de405247106832d4700f4371 /client/src/camera.rs | |
parent | dbfb01fa7b5b05686dcbdd9d73643d7866810668 (diff) | |
download | weareserver-47e5b44576e581ae0b62ad1e3bed444b8a82cefd.tar weareserver-47e5b44576e581ae0b62ad1e3bed444b8a82cefd.tar.bz2 weareserver-47e5b44576e581ae0b62ad1e3bed444b8a82cefd.tar.zst |
spawn ui in world with click
Diffstat (limited to 'client/src/camera.rs')
-rw-r--r-- | client/src/camera.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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 <https://www.gnu.org/licenses/>. */ -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.), + ) + } } |