Welded Parts Causing High Amounts of Physics Lag?

I’ve been using body movers to move around a high number of models around.

This works fine up to the 200’s where it then becomes to lag at amazing amounts:

The problem is when I just use the main part affected by physics:

It’s completely fine

My question is if it’s the physics causing the large amount of lag due to more physics being applied to welded parts, or if it’s the models (they’re each around 1000 tris).

1 Like

Do they have animations? its a bit difficult to tell in the video.

Yes I’ve tried without, with the same effect though.

It looks like it, they seem to be jumping if you watch carefully. Also, in the second video, there’s two characters at the back with animations.

As @Polyheximal said they do seem to jump. I would use the micro profiler to narrow down what is causing the frame drop.

I’ve used it but I’m not quite sure which data explains it.

https://gyazo.com/e299339efb4eafe5dc129830052d3419

Based on your screenshot (the width of the bar is the amount of time that thing took) Render is very high. That most likely suggests this is not due to physics, but rather rendering on the client. Try setting every part’s Transparency to 0 excluding the base of the model and see if you get normal fps. If so, you may have too many triangles in your Meshes.

The render is taking ageeeees…

Set the transparency of everything to 0, so you can’t see anything at all, the FPS lag remains around the same.

How would you propose the fix? From what I saw the post discussed something which isn’t part of the engine.

And with nothing visible, it still has a massive drop in FPS.

Perhaps try turning collisions off? I saw a post somewhere where someone experimented with the FPS when zombies collided with each other, and saw a massive lag spike when they did, opposed to when they didn’t touch each other.

All of the parts have no collision.

Just as an update, it’s fine when it’s 80, at around 95 it begins to completely drop FPS.

Try setting Part.CastShadow = false on all the parts you are moving

Unfortunately this most likely would not help. According to above they tried setting the parts to Transparency 1 which has the same effect as disabling shadows. This does appear to be physics based.

@BladianMC Can you tell us what specific joint types you are using? Have you tried setting parts to CanCollide false and Massless true together? Are you creating body movers in these parts or are you only using one mover for the root? What types of body movers are you using? Are any of your scripts looping over Descendants, Children, etc of your models? Does this only occur in the Roblox player or studio explicitly?

Mix of Motor6D’s, Welds and WeldConstraints.

CanCollide is false, and Masless is true

Each one has an align position.

It only loops through the primary parts of the model (second gif doesn’t lag as much).

I’ve only tested in studio will update.

Does roblox apply physics to things even if they’re welded? Could that explain the high intensity?

The Render bar displayed in the image is a worker thread waiting for the Main thread (where the actual rendering is happening) to finish. If you drag the microprofiler upward, you’ll be able to see the Main thread hiding at the bottom. That should hopefully show more detail on the cause.

The cause may involve instancing, which is detailed here:

https://gyazo.com/d2a22ccb1657859bbc5cdd8108fc86bd

This is the most bottom section which I could find with info.

Better screenshot.

https://gyazo.com/36f444bc85e43fdbbafc0bb0e3bd9cb0

You should replace your WeldConstraints with Welds. I’ve found WeldConstraints to be very strange in terms of their behaviour. It appears as if they don’t actually create a real rigid joint, but simply move their connected parts in unison without changes to physics. I have been able to separate parts using WeldConstraints which should be impossible, so maybe this could be a reason for physics lag.

Additionally, what @Anaminus said is correct, the render section appears to be the actual issue, not physics. I believe if you zoom in (mouse wheel) and move everything all the way down you should be able to see more detail for the render section. It should have a Textures and Lighting section to it. You can pause the microprofiler as well which will help with moving it.

Are you 100% sure you set the part’s transparencies to 1.0? Doing this should prevent them from rendering at all if I’m not mistaken. Make sure you don’t have Textures/Decals or anything within these parts when you do this.