Actually, the workaround above won't work either – it works in this case when the field source is also the target node (the position will always be a zero vector) however the target needs to know its position relative to the field source.
Post
Replies
Boosts
Views
Activity
Thank you, Greg, for confirming I wasn't pushing the wrong button somewhere.
Regarding the workaround, I can see how this code would work in a closure (with access to ballNode). However – as you may imagine – my actual physics simulator is a bit more complicated and stored in a separate file.
I'm guessing there is no way to access the node's attributes when the customField calculations are in a method located elsewhere?
This section from the Swift Programming Language documentation might add some more information. Essentially the rule is you can't use any part of self until the type is fully formed.