Need MeshParts to behave as if they were unioned together

I’m making an AI for a creature. The creature is a model that consists of two MeshParts (both exactly the same but one is translucent/offset from the opaque one) and two eyes (which are unioned spheres). The model was done by a friend who asked me to script this. Part of the scripting I’m doing is making sure that the creature can’t be rotated on the X or Z axis. I’m testing to see if my script works by dropping the creature in a way that would make it flip over. However, it doesn’t seem to be working correctly no matter what I do. I started by setting the PrimaryPart’s orientation (which right now is the opaque MeshPart), but the rest of the model flips over. I then went to CFrames and SetPrimaryPartCFrame, but I got the same results. I ended up trying Welds instead of WeldConstraints, and I got the same behavior. It seems like no matter what CFrame scripting I do and no matter what welding I do, the other parts of the model rotate on the X and Z axis when they fall. I can’t go into Blender and export the entire model together, because the two MeshParts are each 10,000 triangles exactly, and I feel trying to reduce the tri count of both MeshParts plus the eyes will degrade the quality of the model severly.

This is what the model looks like normally:
good
This is what it looks like after I do the fall test:
bad

If anyone could offer any suggestions on what to do here, that would be great.

This seems to be the real problem. Using welds to weld a model together will work and solve your problem, but it seems however you implemented it is where bad things happened.

A weld will make sure the Part1 will stay relative to the Part0 based on the C0 * C1 properties. They won’t move independently after being correctly joined. How did you attempt to “weld” them?

2 Likes

I welded them via script. I think this was the code I used:

local weld = Instance.new("Weld")
weld.Part0 = body --this is my variable for the opaque mesh part
weld.Part1 = otherPart --this will be either the translucent mesh part or one of the eyes
weld.C0 = body.CFrame:Inverse()
weld.C1 = otherPart.CFrame:Inverse()
weld.Parent = otherPart

Does this help?

I’m not sure why you need to put any inverses in there. There’s no reason for that in this case.

This is my result using just a normal WeldConstraint made in studio.

1 Like

Never mind, I managed to fix it. I used regular Welds combined with changing the CFrame of the PrimaryPart to get what I wanted. Thanks for your insight on Welds. The only problem now is that there seems to be velocity affecting the parts now. CanCollide is only on for one of them. Do you have any idea as to why that is?

1 Like

Sorry, I don’t understand how those two sentences are related or what the problem is you’re describing that is happening to them.

Here’s a video of the issue:

Basically he’s sliding on the ground now. I thought CanCollide would be relevant because it could be that the parts were colliding with each other and causing the whole model to move.

EDIT: This has to do with my code, so I’ll need to look into that myself. The original problem has been solved, so thank you for your help.