-- Castle Deck script to spin an actor directly
function onUpdate(dt)
dt = dt or 0.016
-- Ensure my.layout exists and update its rotation in degrees
if my and my.layout then
local currentRotation = my.layout.rotation or 0
my.layout.rotation = currentRotation + (90 * dt)
end
end
-- Tracking rotation angles
local rx, ry, rz = 0, 0, 0
-- 8 vertices of a 3D unit cube
local verts = {
{-1, -1, -1}, { 1, -1, -1}, { 1, 1, -1}, {-1, 1, -1},
{-1, -1, 1}, { 1, -1, 1}, { 1, 1, 1}, {-1, 1, 1}
}
-- 12 connecting edges
local edges = {
{1,2},{2,3},{3,4},{4,1},
{5,6},{6,7},{7,8},{8,5},
{1,5},{2,6},{3,7},{4,8}
}
-- Calculate 3D perspective projection onto a 10x10 text grid
local function project(v, aX, aY, aZ)
local x, y, z = v[1], v[2], v[3]
-- Rotate X
local y1 = y * math.cos(aX) - z * math.sin(aX)
local z1 = y * math.sin(aX) + z * math.cos(aX)
-- Rotate Y
local x2 = x * math.cos(aY) + z1 * math.sin(aY)
l