How to optimize hinges?

If you have a bigger number of hinges, or any mechanical constraint, like over 20, it causes quite some lag. But how can I reduce it? Ik you can set networkownership to the client, but would that help in every scenario? Are there more, better ways to opimize them?

4 Likes

There isn’t really a good way to optimize them, what I suggest is keep StreamingEnabled, if you got MANY hinges try to see which aren’t necessary, also, if possible, create them on client

would making it on client make it worse on mobile devices or better? Since client implies YOUR device runs the physics or whatever it is now. And most of them are pretty weak

Since the movement isn’t controlled by a script I don’t think we can optimize it. It’s a bit like if 20 parts were falling, they’ll feel laggy cuz it’s the server that’s calculating the trajectory.

2 Likes

what if it was controlled by a script? Lets say I generate 20 parts, each connected by a hinge. Can anythying be done with a script to make it more optimized? Or yk what? Is there a way to do something like a hinge with a script? My goal is to make a chain that behaves like a chain. I already know how I will make the chain parts themselves so, that they are most optimized

Oh I see what you want to do, is it a chain that’s fixed to something and you want to add an animation to it? I mean for exemple do u want the chain to be decorative or it’s interactive.

Nope, the chain is a part of an underwater puzzle. It consists of 2 chain parts. A fake one and a real one. The chain is a pulley going through multiple wheels. 90 percent of the chain will be done by beams ( the game is 2d). The other 10 percent is the end or should I say beginning of the chain. A loose chain welded to an anchor. You have to take the anchor and pull the chain with it, but you dont have enough space to swim further and tighten up the chain completly, so you wrap it around some stuff

I tried so many methods, this seems to be the best one

so short answer: It is interacive

1 Like

If it was decorative I would’ve said to use an animation but nevermind idk how to help then sorry.

Wait actually if you want you can make the chain animate itself. Since your game is 2D it’ll be easier.

For exemple, when the player touch the correct chain then the chain CanCollide become false and the animation of the chain plays like if the player pushed it. So it’s interactive. I don’t know If u see what I mean.

but you are controlling the chain movement, how can there be an animation predone? Btw do you know if the newer constraints cause lag too?

also, are mover constraints more performent then mechanical constraints?

Your issue shouldn’t need much optimization.
I have tank tread vehicles with suspension (I’m guessing around 80-90 hinges, PrismaticConstraints, and SpringConstraints and they don’t lag noticeably. If I load a baseplate with 20 of them it’ll start to lag, but that’s another story.
What else is going on in your game that may be causing the lag? Do you have an older computer or slower internet speed?

that is the point. I dont expirience lag cause I have a good pc. Many other users will, not everyone can afford a good device. You may not notice any lag with 80 + constraints, but mobile users will. Heck even ppl with a pc might. Internet speed is something I can’t change for players, but finding a way how I will optimize my expirience the most is the least I can do

By making multiple animations. But if you want I can make you a quick model If you don’t know how to.

uhh I am still not sure what you mean, can ya show it in a recording or drawing?

1 Like

I can’t really draw it, it’s really just an animation.
What I would’ve done to prevent lag is to go in blender with the chain and insert a bone in it, then export it to studio and when player touch the chain an animation of the chain mimic like if the player was moving the chain.

A bit more tricky and will be a bit less realistic as if the player actually was moving the chain but it’ll work fine for every devices

but how am I gonna predict every possible outcome? Like lets say the player swims up, then slowly to the right and then quickly to the left. Anything can happen, how is gona animation predict that? And how will I wrap the chain around objects?