-- entity_scanner.lua - Scans all entities on interact -- Tests: Entity.ForEach, Entity.GetPosition, Entity.IsActive, Entity.GetCount, -- Entity.FindByIndex, Entity.FindByScriptIndex, Vec3.lerp, Vec3.distanceSq function onInteract(self) setStatus("Scanning all entities...") Debug.Log("=== Entity Scan ===") local total = Entity.GetCount() Debug.Log("Total entities: " .. total) local activeCount = 0 Entity.ForEach(function(obj, index) local pos = Entity.GetPosition(obj) activeCount = activeCount + 1 Debug.Log(" [" .. index .. "] pos=" .. pos.x .. "," .. pos.y .. "," .. pos.z .. " active=" .. tostring(Entity.IsActive(obj))) end) Debug.Log("Active: " .. activeCount .. " of " .. total) setStatus("Scan: " .. activeCount .. "/" .. total .. " active") local first = Entity.FindByIndex(0) if first then local pos = Entity.GetPosition(first) Debug.Log("Entity 0 at " .. pos.x .. "," .. pos.y .. "," .. pos.z) end local byScript = Entity.FindByScriptIndex(0) if byScript then Debug.Log("Found entity using script 0") end local a = Vec3.new(0, 0, 0) local b = Vec3.new(10, 20, 30) local mid = Vec3.lerp(a, b, 1/2) Debug.Log("Vec3.lerp midpoint: " .. mid.x .. "," .. mid.y .. "," .. mid.z) local dsq = Vec3.distanceSq(a, b) Debug.Log("Vec3.distanceSq: " .. dsq) end