The problem:
I’ve recently come across a problem involving a custom character rig I’m working on. I need to weld a limb, say the RightHand, of my character to an anchored part so that the anchored part is connected to the limb. However, the problem emerges that instantly after establishing the Weld, WeldConstraint, or Motor6d( they all create the same issue ), the entire rig freezes and can’t be moved. This happens when creating the weld from both the client and the server, and network ownership makes no difference.
Here is an extremely brief clip that just shows how when the weld is created( which happens when the arm touches the anchored wall ), the entire character freezes while the weld is active: https://gyazo.com/302fb0b0c05fc2cef6735ce684f04466
My current workaround:
The mid production solution at the moment is to simply make the said “anchored parts” I want the player to interact with not anchored at all, but in fact un-anchored but containing a very powerful BodyGyro and BodyPosition to keep the part idle. This does not produce the freezing, and generally works well. However, this is an extremely hacky workaround, and I’m working on a professional game where performance matters greatly, so I really don’t want this to be the permanent solution.
Does anyone know of any good alternatives to my bad “part held in place with physics” solution?
Thanks, ExcessEnergy
if you really want to make the part in the rig to be anchored i would say make the player walkspeed to 0 which would have the exact kinda effect of anchoring while making the player move
Edit:show what your rig is so i can get a solution to your problem
I don’t necessarily want the rig to be idle. It’s quite a complicated problem, as my custom rig isn’t connected by Motor6ds, but rather BallSocketConstraints.
I can’t reveal too much about the system’s workings, as the project is supposed to stay a secret for the time being, but all you really need to know is that all of the parts that make up the rig are connected by BallSocketConstraints, and are un-anchored. The rig moves by using physics forces.
That being said, the rig should still be able to move freely with it’s BallSocketConstraints, and only the hand would be welded to the anchored part, with the other joints still free to move even if they are attached to the hand.
From what I’ve read on the DevHub (anchoring parts), an anchored part will be the root of your assembly - so the HumanoidRootPart gets overridden as the root part which might impact the way the rig is able to move around.
It could be a bug for all we know as I wouldn’t expect the entire rig to be anchored - if no one else can chime in on this then try to file a bug report.
There is also the case of sleeping physics (I’ve encountered this myself but on a 3-spring system), although I did not have an anchored part attached for it to freeze up. Might be worth looking into.
I just did a quick test to make sure nothing was sleeping during the time of the issue, and it seems that when the rig is connected to the anchored part( which is in the workspace, not in the rig model ) via weld, the entire rig goes asleep. As to why this happens I have no idea.
As @tralalah Is believe it’s a root part thing caused by the weld.
However an alternative solution should be to use another ball socket constraint to connect the arm with the wall BallSocketConstraint | Roblox Creator Documentation. This should prevent the root part stuff while working with the physics engine to stick onto the wall.
I tried connecting the wall to the hand using a BallSocketConstraint instead of a WeldConstraint( parented to the hand part with the Attachment0 and Attachment1 in the wall and the hand part ). However, I got the same result of freezing the entire character. Is this what you were suggesting me try?
Yep, I guess it’s still cause of the root part. To confirm the hypothesis that it’s because of the root part being anchored create an non collide unanchored part that is at that location using with AlignPosition | Roblox Creator Documentation set to rigid and then do the ball socket or weld from there.
Otherwise try forcing the parts awake by applying a tiny amount of force in a random direction constantly.
I will certainly try this specifically later, but I can almost guarantee it will work. If you read “My current workaround” in the original post, you’ll see that this is basically what I’m doing now. However, this is a pretty inconvenient and seems a bit hacky, which is why I created this post to see if there was a better solution.
EDIT:
Yes, it seems your hypothesis is correct, as this method does avoid the freezing issue. I’m not sure if there is one, but I am still hoping for a less odd and more simple way though.