SceneKit: rotating transform with nonzero pivot behaves differently on macOS and other platforms

Originator:igeek1
Number:rdar://49193195 Date Originated:March 24 2019, 12:34 AM
Status:Fixed Resolved:May 29, 2019 at 7:46 PM
Product:macOS + SDK Scene Kit Product Version:Xcode 10.2 (10P107d) on macOS 10.14.3 (18D109)
Classification:Serious Bug Reproducible:Always
 
Summary:
On macOS, if you rotate the transform of an SCNNode whose pivot is not the identity transform, the node rotates around the pivot, just like if you had set the rotation of the node directly. On all other platforms, the node rotates around the center of its parent node instead of around its pivot.

Steps to Reproduce:
1. Open the attached Playground. It contains a simple scene with three SCNCapsule nodes connected end-to-end, then rotated so they form an upside-down U shape.
2. Run it as a macOS Playground. Observe how the nodes are connected end to end.
3. Switch the Playground to run on iOS or tvOS.

Expected Results:
The capsules are connected the same way as when running on macOS.

Actual Results:
The nodes are not connected the same. They appear to have pivoted around their parent node’s center instead of around their own pivots.

Version/Build:
Xcode 10.2 (10P107d) on macOS 10.14.3 (18D109)

Notes:
In the Playground, you will find:

let demonstrateBugOnIOS = true

If you change this constant to false instead, you will see the workaround I found: adjusting the rotation directly instead of rotating the transform.

I’m not sure which behavior is actually correct here. I guess it would be reasonable that modifying the transform directly would ignore the pivot point, since the pivot is documented as affecting only position, rotation, and scale. However, on macOS, adjusting the transform directly appears to be honoring the pivot, but on iOS, tvOS, and watchOS, something else is happening instead. And whichever the right behavior is, they should probably be consistent across all 4 platforms.

Playground also uploaded here: https://cl.ly/4063bbdb98f4

Comments

Fixed in Catalina/iOS 13 beta 1


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!