From 6bb5583d7087419861b250c83f8783996bf5f9f8 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Mon, 6 Aug 2012 13:24:41 +0200 Subject: Added setPos --- Spear/Math/Spatial.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Spear/Math/Spatial.hs b/Spear/Math/Spatial.hs index d925f6f..fe2700f 100644 --- a/Spear/Math/Spatial.hs +++ b/Spear/Math/Spatial.hs @@ -49,6 +49,14 @@ class Spatial s where -- | Set the 'Spatial''s transform. setTransform :: Matrix4 -> s -> s + -- | Set the 'Spatial''s position. + setPos :: Vector3 -> s -> s + setPos p s = setTransform t' s + where t' = M.transform r u f p + r = Spear.Math.Spatial.right s + u = Spear.Math.Spatial.up s + f = Spear.Math.Spatial.fwd s + -- | Make the 'Spatial' look at the given point. lookAt :: Vector3 -> s -> s lookAt pt s = -- cgit v1.2.3