Vec3ExampleCode

From Crumbled World Wiki
Revision as of 07:54, 6 July 2025 by Anders (talk | contribs) (Created page with "==Example Code== <syntaxhighlight lang="lua"> local a = Vec3(6,8,0) local b = a + Vec3(-2,-2, 1) * 2 print("Vec3(" . .b.x .. ", " .. b.y .. ", " .. b.z .. ")") --print Vec3(2.0, 4.0, 2.0) a:normalize() print(tostring(a)) --print Vec3(0.6, 0.8, 0.0) </syntaxhighlight>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example Code

local a = Vec3(6,8,0)
local b = a + Vec3(-2,-2, 1) * 2
print("Vec3(" . .b.x .. ", " .. b.y .. ", " .. b.z .. ")")    --print Vec3(2.0, 4.0, 2.0)
a:normalize()
print(tostring(a))    --print Vec3(0.6, 0.8, 0.0)