Best way to get constraints to snap to where they should be?

Hello,

I’ve been experimenting with Studio’s built-in constraints and thought it’d be fun to create some “Physics-based” accessories. So far this has gone really pretty well and I’m really happy with how it looks, I think it adds a lot of life to the outfit (although I haven’t got the angle limits just right yet): https://gyazo.com/97e7321af2b87af07ccdb67d7d4cc3ec

However, a problem arises in regards to gameplay because whenever the player teleports, instead of snapping, the constraint seems to glide towards the player slowly, causing a bundle of problems:
https://gyazo.com/36d1dd52c179f5a5a4c4226593eab895

Is there a built-in way to make the attachments “stick together”? I had thought they would anyway, since moving the character should move everything inside of it relative to it right? I’m relatively new to using constraints.
If there’s not a built-in way, what would be a good way of forcing the attachments to stay together while still maintaining the physics while still being performance-effective?

(Edit: I’m using Hinge/Ball in Socket Constraints)

When you teleport the player you could use :SetPrimaryPartCFrame() on the player model, which should move everything under the model with it.

If I recall correctly, SetPrimaryPartCFrame is now deprecated. I’m using the updated method, :PivotTo() which does the same thing, it just doesn’t seem to register.

It’s like this, the part in question is a descendant of the character, so I’m led to believe its a constraint-based problem: https://gyazo.com/b3d92fd51eb71e3010ff6eb31e1201cc

Ok. I messed around and came up with this script that worked for me when testing with teleporting constraints. Hope it helps!

local ChainCFrame = HumanoidRootPart.CFrame:ToObjectSpace(Chain.CFrame)
HumanoidRootPart.CFrame = CFrame.new(10, 10, 10)--Code that teleports player
Chain.CFrame = HumanoidRootPart.CFrame:ToWorldSpace(ChainCFrame)
1 Like

This works nicely alongside the teleport code, but I was really hoping there would be a way to always have the constraint in the place it should be, and it feels like a bit of a strange feature to have it aimlessly move until it reaches it’s destination

Nonetheless, if I can’t find another way this will have to be it I guess! Thank you for the answer :slight_smile:

I think an easy hack is to disable the hinge constraints temporarily and create a RigidConstraint similar to a weld using the same attachment configuration.

Otherwise you could try to emulate the RigidConstraint method above using CFrames and solve the C0 and C1 and convert it into world space.

Tried your method of using RigidConstraints, worked well actually but I feel like directly setting the CFrame is the better method here cuz it’s probably way more performant (as you don’t have to create any new instances) and uses less coding too.