summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-10-25 20:56:01 +0200
committerHampusM <hampus@hampusmat.com>2023-10-25 20:56:01 +0200
commit0c0dc186b542bf6bdd7645ba091dc2a47a03fa97 (patch)
treea656e64e1dfcae37b518c50aab99fdafb99a8e0f /engine
parent47798568f3f05b8267ae3700369a4a396073ef97 (diff)
feat(engine): add object position getter
Diffstat (limited to 'engine')
-rw-r--r--engine/src/object.rs6
-rw-r--r--engine/src/transform.rs5
2 files changed, 11 insertions, 0 deletions
diff --git a/engine/src/object.rs b/engine/src/object.rs
index 02ae97a..9952c5f 100644
--- a/engine/src/object.rs
+++ b/engine/src/object.rs
@@ -76,6 +76,12 @@ impl Object
self.id
}
+ #[must_use]
+ pub fn position(&self) -> &Vec3<f32>
+ {
+ self.transform.translation()
+ }
+
pub fn translate(&mut self, translation: Vec3<f32>)
{
self.transform.set_translation(translation);
diff --git a/engine/src/transform.rs b/engine/src/transform.rs
index 9ce52ee..c216fdd 100644
--- a/engine/src/transform.rs
+++ b/engine/src/transform.rs
@@ -22,6 +22,11 @@ impl Transform
}
}
+ pub fn translation(&self) -> &Vec3<f32>
+ {
+ &self.translation
+ }
+
pub fn set_translation(&mut self, translation: Vec3<f32>)
{
self.translation = translation;