I need to associate SceneKit Node objects with arbitrary objects in my program and am looking for an optimal solution.
Here is an example of what I mean:
Say I have a program that renders atoms in a molecule using SceneKit. I have classes Molecule
and Atom
that model my data. I then render the molecule using SceneKit.
When I click on a sphere node in the Scene View, I need to know which Atom
object that sphere represents (the Molecule
contains an array of Atoms
)
I could create a Dictionary that maps Node
to Atom
object, but wonder if there is a way to add an Atom
object reference to the sphere node. Should one use Key-Value bindings?
I am very new to Cocoa programming and am looking for a nudge in the right direction for an approach. I can then research the implementation specifics.