1

I found a very strange error when I try to flip an ARSCNView vertically on an iPad, what I need to do suppose to be:

sceneView.transform = sceneView.transform.scaledBy(x: 1, y: -1)

which should flip the ARSCNView vertically. It rotates 90 degrees instead of flipping. Strangely the following gives the same result:

sceneView.transform = sceneView.transform.scaledBy(x: -1, y: 1)

Scale X and Y should not rotate the View.

Where this problem happens: Ipad pro 12.9 2019, iOS 14.0.1, in portrait mode

What else that I tried: Everything works on iPhone.

The following works but not what I need

sceneView.transform = sceneView.transform.rotated(by: .pi)
  1. on the same device landscape works in both directions. The error only occurs when portrait or portrait upsidedown.

Does anyone have any ideas on how I can get around?

user2485972
  • 147
  • 1
  • 8

1 Answers1

1

You probably want

sceneView.transform = CGAffineTransform(scaleX: -1, y: 1)

because scaledBy scales off the existing transform, which might not be .identity.

But you might want to check out this answer too.

aheze
  • 24,434
  • 8
  • 68
  • 125
  • 1
    This gives the same result for me I check it gives the same transform matrix (a=-1, b=0, c=0, d = 1) and for some reason, the view is rotated 90 degrees instead of flipping. The other post you mentioned is very interested I will check. Thanks! – user2485972 Oct 09 '20 at 21:29