I believe that in Swift
GLKVector3s are immutable, whether a
var or a
GLKVector3Make to create one with arbitrary
Float values; subsequently generate new results to new instances.
let ballLocation = GLKVector3Make( (locationInBallCoordinates.x - ballCentre.x) / ballRadius, 0.0, (locationInBallCoordinates.y - ballCentre.y) / ballRadius)
ballCentre were already instances of
GLKVector3 — and the y-to-z component switch that I hadn't noticed when I first wrote this answer weren't there — then:
let ballLocation = GLKVector3DivideScalar( GLKVector3Subtract(locationInBallCoordinates, ballCentre), ballRadius)
It's probably easiest to unpack and repack to move
zs but you could also use a matrix multiply if you were desperate to keep it high level.