Part faces become transparent when modifying CFrame

To recreate the bug, open testfile.rbxl (17.4 KB), and run this code in the command bar.

workspace.parttest.CFrame = CFrame.new(-11, .5, 1, 1, 0, 0, 0, -1, 0, 0, 0, 1)

This code turns the part upside down. Here are some pictures, and I put a weld on the top face.
.
.

before

after

I just noticed this. It does not happen in game, and it does not happen in studio while you are testing (playing the game). I’m on a Mac. This does not happen when rotating the part with CFrame.Angles.

You’re constructing a CFrame where the rotation matrix part has a -1 determinant, which makes it not a valid rotation matrix.If a part is physically simulated, the physics engine code will fix it by orthonormalizing it.If it’s not physically simulated (e.g. anchored), it will retain the invalid matrix and get drawn inside out. You’re flipping the part upside-down by mirroring it across its x-z plane, which also changes the winding direction of the vertices, so the faces get rendered with the normals facing the wrong way.

5 Likes

Just replace -1 with 1. You should not use negative values in rotation such as this.

workspace.parttest.CFrame = CFrame.new(-11, .5, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1)

This is not an issue with Roblox Studio.

Oops, I should have also made the Z value -1 (or X ).