Moving and resizing small parts causes geometry to lag

In my cape simulation, it has 1v1v1 wedge parts with wedge meshes in them. I resize the meshes to fit the desired size and update their CFrame. It runs every frame on the render sequence. The parts are located in a model in camera instance. They are local.


When it’s broken:

When it’s working fine:

You can see the issue in the images. It drops the frame rate. It happens randomly for a random duration of time. Every 1 to 20 seconds lasting for 1 to 10 seconds. Nothing else seems to be broken. I’m 100% sure that the issue is not within the scripts math/physics.

Microprofiler when it is bugged. Seems that updateGeometry is the thing that makes it.

I use it in this place, currrently only two people can have it. The bug occurs here:

I believe having more triangles shown on the screen makes it more common to happen? I can’t reproduce it, it’s quite random.

I’ve put it into this place to test on others:

In this cape sim place, the bug doesn’t happen. In that place, I tried to put 10,000 parts to reproduce:


and moved myself 100,000 studs up and it still doesn’t happen there.

i5 3570
GTX 1060
Windows 10

Setting properties like part.Size, mesh.Scale, color, etc. causes batch updates which can cause lots of lag and delays when set often. Setting part.CFrame is very fast though, so if we could set part.CFrame to a cframe with scaled matrices we could scale and warp parts extremely efficiently without setting .Size. This could be used to do everything from scaling character models, to efficiently drawing size-changing triangles without delays, to animating stretchy foliage.

It would be as simple as doing something like this

local function ScaleCFrame(cf, sx, sy, sz)
local px, py, pz, xx, yx, zx, xy, yy, zy, xz, yz, zz = cf:components()
return, py, pz, xx*sx, yx*sy, zx*sz, xy*sx, yy*sy, zy*sz, xz*sx, yz*sy, zz*sz)

part.CFrame = ScaleCFrame(partCFrame, sizeScale.X, sizeScale.Y, sizeScale.Z)

Old suggestion that could resolve your problem:

I also suggested this at RDC last year but I remember @zeuxcg saying that .Size should just be more efficient. Maybe setting .Size every frame could transform the cframe automatically so less updates are required; this wouldn’t let us do part warping though.

This is one of the few things that hold me back on roblox. I could animate my character’s height changing at full 60fps, I could make characters squished/shorter, or stretch them in cool ways, I could add skirt physics, animate my character’s pupils better, and just create fluid polished animations for all kinds of things.

Yeah, I see. I also found this thread:

in which @maxvee and @zeuxcg said: