0

According to the SceneKit API, euler angles, as a property of SCNNode, are SCNVector3. And SCNVector3 is { CGFloat x, y, z: }. But when I attempt to assign a CGFloat to a eulerAngle property of a node, Xcode claims I'm trying to assign to type 'Float'. Here's a snippet from my panGesture handler:

    baseNode.eulerAngles.x = newAngleX

I can avoid this by casting as Floats but I'm curious, especially since SCNVector3 still seems to accept CGFloats.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
bpedit
  • 1,176
  • 8
  • 22

1 Answers1

1

You're right, the documentation is wrong. Directly from SceneKit/SceneKitTypes.h:

typedef struct SCNVector3 {
    float x, y, z;
} SCNVector3;

Which, amongst other things, means they're 32-bit regardless of target, unlike CGFloats. So it's not a mere typedef issue despite the naming similarity — Swift is right to want an explicit cast.

Tommy
  • 99,986
  • 12
  • 185
  • 204