This commit is contained in:
Jan Racek
2026-03-29 09:34:46 +02:00
commit 1fdb223f5d
113 changed files with 17499 additions and 0 deletions

25
Assets/lua/spinner.lua Normal file
View File

@@ -0,0 +1,25 @@
-- ============================================================================
-- spinner.lua - Continuously rotating object (onUpdate demo)
-- ============================================================================
-- Tests: onUpdate, self.rotationY, Entity.GetRotationY, Entity.SetRotationY,
-- Timer.GetFrameCount, self.position, Entity.GetPosition
local speed = 1 -- pi-units per frame
function onCreate(self)
Debug.Log("Spinner created, initial rotY: " .. self.rotationY)
end
function onUpdate(self, dt)
-- Rotate the object by speed * dt each frame
local current = Entity.GetRotationY(self)
Entity.SetRotationY(self, current + speed * dt)
-- Every 300 frames, log position and rotation (test Timer)
if Timer.GetFrameCount() % 300 == 0 then
local pos = Entity.GetPosition(self)
Debug.Log("Spinner at frame " .. Timer.GetFrameCount()
.. " pos=" .. pos.x .. "," .. pos.y .. "," .. pos.z
.. " rotY=" .. Entity.GetRotationY(self))
end
end