So, I came up with an idea for 3D rigging. Here it is:

```
--# Main
-- SkyRig
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
-- all the unique vertices that make up a cube
local vertices = {
vec3(-0.5, -0.5, 0.5), -- Left bottom front
vec3( 0.5, -0.5, 0.5), -- Right bottom front
vec3( 0.5, 0.5, 0.5), -- Right top front
vec3(-0.5, 0.5, 0.5), -- Left top front
vec3(-0.5, -0.5, -0.5), -- Left bottom back
vec3( 0.5, -0.5, -0.5), -- Right bottom back
vec3( 0.5, 0.5, -0.5), -- Right top back
vec3(-0.5, 0.5, -0.5), -- Left top back
}
-- now construct a cube out of the vertices above
local cubeverts = {
-- Front
vertices[1], vertices[2], vertices[3],
vertices[1], vertices[3], vertices[4],
-- Right
vertices[2], vertices[6], vertices[7],
vertices[2], vertices[7], vertices[3],
-- Back
vertices[6], vertices[5], vertices[8],
vertices[6], vertices[8], vertices[7],
-- Left
vertices[5], vertices[1], vertices[4],
vertices[5], vertices[4], vertices[8],
-- Top
vertices[4], vertices[3], vertices[7],
vertices[4], vertices[7], vertices[8],
-- Bottom
vertices[5], vertices[6], vertices[2],
vertices[5], vertices[2], vertices[1],
}
-- all the unique texture positions needed
local texvertices = { vec2(0.03,0.24),
vec2(0.97,0.24),
vec2(0.03,0.69),
vec2(0.97,0.69) }
-- apply the texture coordinates to each triangle
local cubetexCoords = {
-- Front
texvertices[1], texvertices[2], texvertices[4],
texvertices[1], texvertices[4], texvertices[3],
-- Right
texvertices[1], texvertices[2], texvertices[4],
texvertices[1], texvertices[4], texvertices[3],
-- Back
texvertices[1], texvertices[2], texvertices[4],
texvertices[1], texvertices[4], texvertices[3],
-- Left
texvertices[1], texvertices[2], texvertices[4],
texvertices[1], texvertices[4], texvertices[3],
-- Top
texvertices[1], texvertices[2], texvertices[4],
texvertices[1], texvertices[4], texvertices[3],
-- Bottom
texvertices[1], texvertices[2], texvertices[4],
texvertices[1], texvertices[4], texvertices[3],
}
m = mesh()
m.vertices = cubeverts
m.texCoords = cubetexCoords
m.texture = "Planet Cute:Grass Block"
m:setColors(color(255))
r = Rig(m, cubeverts)
anim()
end
function anim()
local t1 = tween(2, r.motion, {x = 2, y = -1, z = -1.5}, tween.easing.bounceOut)
local t2 = tween(2, r.motion, {x = -1, y = 0.5, z = 0.5}, tween.easing.quadInOut)
local t3 = tween(2, r.motion, {x = 0, y = -0.5, z = 0}, tween.easing.bounceOut)
local t4 = tween(2, r.motion, {x = 0, y = 0.5, z = 0}, tween.easing.bounceIn, anim)
tween.sequence(t1, t2, t3, t4)
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
camera(3, 3, -5, 0, 0, 0)
perspective(45)
r:update()
-- Motion delta debug print
--print(vec3(r.mot.x - r.lastMot.x, r.mot.y - r.lastMot.y, r.mot.z - r.lastMot.z))
m = r:getMesh()
m:draw()
end
--# Rig
Rig = class()
function Rig:init(m, v)
self.m = m
self.v = v
self.lastMot = {x = 0, y = 0, z = 0}
self.mot = table.copy(self.lastMot)
self.motion = table.copy(self.mot)
end
function Rig:update()
self.lastMot = table.copy(self.mot)
self.mot = table.copy(self.motion)
--print(self.mot.x, self.lastMot.x)
local dx, dy, dz = self.mot.x - self.lastMot.x, self.mot.y - self.lastMot.y, self.mot.z - self.lastMot.z
for k, v in pairs(self.v) do
self.v[k] = vec3(v.x + dx, v.y + dy, v.z + dz)
end
self.m.vertices = self.v
end
function Rig:getMesh()
return self.m
end
--# Util
function table.copy(t)
local tbl = {}
for k, v in pairs(t) do
tbl[k] = v
end
return tbl
end
```

(Long-press on Add New Project)

It simply changes the vertices of the mesh to move with the Tweens. The W.I.P. part: changing part of a mesh. I attempted to add “vertex sets” which just keep track of the starts and ends of a vertex’s vertices, but kinda failed, as nothing moved. That’s the part I need help with. Any help would be greatly appreciated. Thanks in advance!

Note: The code above actually works and moves the cube without translating or moving the camera.