Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Hand positions in a circle
--lua 5.3 local colors = {} colors[1] = "White" colors[2] = "Blue" colors[3] = "Brown" colors[4] = "Green" colors[5] = "Orange" colors[6] = "Pink" colors[7] = "Purple" colors[8] = "Red" colors[9] = "Teal" colors[10] = "Yellow" local radius = 65 --distance for hand from center local heading = 180 --initial heading. We're going clockwise from the top-most point, so 90+(36/2) local sin, cos, rad = math.sin, math.cos, math.rad local positions = {} for k,v in ipairs(colors) do positions[k] = { x = sin(rad(heading))*radius, z = cos(rad(heading))*radius, h = heading, c = v, } heading = heading + (360/#colors) end for k,v in ipairs(positions) do local str = [[ { "Color": "]]..v.c..[[", "Transform": { "posX": ]]..v.x..[[, "posY": 5.0, "posZ": ]]..v.z..[[, "rotX": 0.0, "rotY": ]]..(v.h+180)..[[, "rotZ": 0.0, "scaleX": 20.0, "scaleY": 5.0, "scaleZ": 6.0 } },]] print(str) end
run
|
edit
|
history
|
help
0
lua5.3: ...Desktop/rextester_linux_2.0/usercode/68368288/source.lua:166: unexpected symbol near '}'
Non-Lua core for new scripting languages (Beta)
String Searcher
finding volume of pyramids (for me, but feel free to use)
Root
Lua Timer
test random skill id
MXR
Monty Hall
Linear Regression Lua