diff options
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.), + ) + } } |