Welded Parts Causing High Amounts of Physics Lag?

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.

I’ve used both only Welds and WeldConstraints, didn’t see much of a change in performance when going between the 2.

https://gyazo.com/b7f1eb147a00cc789647af73502e3481

I’m assuming the bottom part explains the lag?

The large bit at the bottom of that screenshot is taking up a huge chunk of time. You should zoom into it so the names are readable. Additionally the time you provided above (~80ms) shows you’d be getting 12 FPS from render time alone. (1/(80/1000)) The chunk you showed looks like it might be taking up even more time.

It’s the raycasting on a run service, completely lags it out apparently.

Any solutions to this?

I’ve upped it to 600 pets, and had no lag, so it was definieterly the issue.

In the top bar of the microprofiler, there’s a Dump menu. This will save a dump file of the selected number of frames to C:\Users\Username. If you’re willing to upload it, we’ll be able to inspect it directly.

1 Like

microprofile-20200224-220134.html (2.1 MB)

It’s definitely ray casting causing the issues.

6000 raycasts a second will probably explain it.

1 Like