Swift subclass SCNNode hittest always returns SCNNode * not * subclass
I have a subclass "ExSCNNode" of SCNNode to add additional properties and behavior to the SCNNode.
class ExSCNNode : SCNNode {
...
}
I than create a scene with ExSCNNode.
let testnode = ExSCNNode()
When smoothing a scene:
// check what nodes are tapped
let p = gestureRecognize.location(in: scnView)
let hitResults = scnView.hitTest(p, options: [:])
// check that we clicked on at least one object
if hitResults.count > 0 {
for hit in hitResults {
let hitnode = hit.node
...
hitnode is SCNNode, not ExSCNNode. But I want ExSCNNode to get access to advanced functionality.
How can I access the subclass instead of the SCNNode class?
+3
source to share