From 6aed8c493b2b1b7f58059a27e5fb240bc5361ade Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 4 Apr 2024 00:05:41 +0100 Subject: launch cactus --- cactus.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cactus.lua b/cactus.lua index b5624d9..7a43da8 100644 --- a/cactus.lua +++ b/cactus.lua @@ -36,10 +36,11 @@ end local function rotatev(v,nq) -- rotates v by n quarters nq = nq%4 - for i = 1,nq do - v.x,v.z = -v.z,v.x + if nq == 0 then return vector.new( v.x, v.y, v.z) + elseif nq == 1 then return vector.new(-v.z, v.y, v.x) + elseif nq == 2 then return vector.new(-v.x, v.y, -v.z) + elseif nq == 3 then return vector.new( v.z, v.y, -v.x) end - return v end local v = vector.new(1,0,0) -- cgit v1.2.3