Issues with Negative Scale Values Not Reflecting Correctly in Simulator

I’ve encountered an issue with setting a negative value for Scale, causing unexpected results for both 3D models and Quads in the simulator.

For the Quads: setting Scale X to a negative value results in a vertical flip in the simulator.

For the 3D models: assigning a negative value to either Scale X or Y results in an inversion across all X, Y, and Z axes, and it seems like the normals are also inverted.

Has anyone experienced a similar issue, or does anyone have any insights into why this might be happening?


Thanks for the great example! We have found that, unfortunately, RealityKit is not as robust to negative scaling as Unity. We’ve tried to work around that as best we can–for instance, by flipping the faceCulling setting of PhysicallyBasedMaterial when the scale is negative, so as to avoid objects’ appearing “inside out”–but that’s about the limit of what we can do, and so the best advice we can give at the moment is just to avoid negative scales entirely.

In this particular case, I can offer some insight into what’s happening in RealityKit. If we set the scale to (-1, 1, 1), if we immediately read back the scale, we get (-1, -1, -1) (with the same translation and rotation). This suggests to me something like a matrix factorization issue: at some point, the original components are used to create a matrix, which is then factored back out into components (translation, rotation, scale). It’s that factorization that isn’t dealing correctly with negative scales.

I’ll raise this issue with Apple, since it’s easy to reproduce.

1 Like

Actually, although we see this issue when using setScale(relativeTo: (parent entity)) (and have reported this issue to Apple), we don’t see the issue when simply setting the scale property directly. So, we can switch to doing that instead and the scales should be correct (although there will still be issues with backface culling and normal directions for negative scales). We’ll make that change in a subsequent version.


Hi! kapolka

Thank you so much for your detailed response!

Understood about the RealityKit issues and will steer clear of negative scaling for now.

Thank you for your report to Apple.

Thank you very much!
I will wait for it to be fixed.
For the remaining issues with backface culling and normal directions concerning negative scales, I’ll explore potential workarounds.

I have confirmed that this has been fixed in Poly Spatial 0.4.3.
Thanks for the quick fix!

3D model still has the problem of flipping the faces, but for now we will deal with it by drawing the back.

1 Like