So earlier today I thought I would try to recreate a cool waving cape using Blender’s Cloth Simulation.
Ultimately I ended up with a 180 frame loop of the simulation which blends together really nicely.
Here is what it looks like without any welding:
Here is what it looks like with welding to a middle part (not yet on the humanoid):
And here is what it looks like welded to the UpperTorso of a R15 Rig:
As you can see there is a clear issue but I’m not sure what it is.
The Cape Model comprises of ~180 Meshes comprising of a file size around 220KB. I believe the faces are around ~2000 faces per mesh.
The script used to animate this is a pretty simple script:
local i = 1
while wait() do
local frame = script.Parent.Parent:FindFirstChild(tostring(i))
local lastFrame = script.Parent.Parent:FindFirstChild(tostring(i-1)) or script.Parent.Parent["180"]
if lastFrame ~= nil then
lastFrame.Transparency = 1
end
frame.Transparency = 0
if i == 180 then
wait()
i = 0
end
i += 1
end
Now this code works and I’ve already confirmed it’s not the weld script causing the issue with the Humanoid so I am wondering if this is an internal engine issue or if its an issue with my code?
This same issue happens to me when I run through frame by frame stuff, it just randomly disappears in some frames but is the script running from the server or client?
1 Like
I thought it could be a client / server issue so I made a new script to handle the transparency of the frames.
The new script is as follows:
local capesToRender = {}
table.foreach(game:GetService('ReplicatedStorage'):WaitForChild('CapeData'):GetChildren(), function(key, object)
capesToRender[object.Name] = {
frame = 1,
cache = object
}
end)
game:GetService('ReplicatedStorage'):WaitForChild('CapeData').ChildAdded:Connect(function(cache)
capesToRender[cache.Name] = {
frame = 1,
cache = cache
}
end)
game:GetService('ReplicatedStorage'):WaitForChild('CapeData').ChildRemoved:Connect(function(child)
table.remove(capesToRender, child.Name)
end)
local function getLastFrame(capeData, i)
local f = workspace:FindFirstChild(capeData.cache.Name):FindFirstChild(tostring(i-1))
if f == nil then
f = workspace:FindFirstChild(capeData.cache.Name):FindFirstChild("180")
end
return f
end
game:GetService('RunService').RenderStepped:Connect(function()
table.foreach(capesToRender, function(charName, capeData)
local lastFrame = getLastFrame(capeData, capeData.frame)
local frame = capeData.cache:FindFirstChild(tostring(capeData.frame))
if lastFrame ~= nil then
lastFrame.Transparency = 1
lastFrame.Parent = capeData.cache
end
frame.Transparency = 0
frame.Parent = workspace:FindFirstChild(charName)
if capeData.frame == 180 then
capeData.frame = 1
else
capeData.frame += 1
end
end)
end)
However the issue still persists.
It might be caused by load times (Roblox doesnt load meshes/textures unless they are ingame)
The quality of each mesh would dramatically increase load times try simplifying it, I would remove physics from it too just incase thats causing it (CanTouch/CanCollide false) You could also try cycling the mesh id’s instead of the meshes