Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding child nodes to terraine nodes on ARSCNView #46

Open
paulsUsername opened this issue Sep 8, 2018 · 1 comment
Open

Adding child nodes to terraine nodes on ARSCNView #46

paulsUsername opened this issue Sep 8, 2018 · 1 comment

Comments

@paulsUsername
Copy link

I have tried a good few different combinations but once I'm on ARSCNView I can't seem to add any child nodes. Even If I don't use terrainNode.convertPosition and just try to add a child to the root node, nothing shows.

The child is being added as if I check the count of arView?.scene.rootNode.childNodes it is increasing every time I add a child node but visually I see nothing.

I am adding them like this with a button once everything loaded:

`
let endSphere = SCNNode(geometry: SCNSphere(radius: 100.0))
endSphere.geometry?.firstMaterial?.diffuse.contents = UIColor.red
endSphere.position = (arView?.scene.rootNode.position)!

    arView?.scene.rootNode.addChildNode(endSphere)
    
    print(arView?.scene.rootNode.childNodes.count)`
@natalia-osa
Copy link
Contributor

natalia-osa commented Sep 10, 2018

Can you please try this:

let node = SCNNode(geometry: SCNSphere(radius: 100.0))
node.geometry?.firstMaterial?.diffuse.contents = .red
let position = positionForLocation(CLLocationValue)
node.position = convertPosition(position, to: self.terrainNode)
terrainNode.addChildNode(firstNode)

Or you can simply use my PR to do it easily (#24) by using terrainNode.projectedSphere method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants