I would like to have a node in the scene, that is somehow clipped to camera node only for y axis. So that when camera moves, this node stays at the same y but moves in x and z with the rest of the scene. Is there some special way I could do something like this, or is the only way to movie the node every time camera moves?
0
votes
You want to add the node as a child of the camera node. Then when you move the camera node, you can also move the child node on the x and z axis. The only problem with this is that you can only move the camera on the x and z axis as well.
- E. Huckabee
1 Answers
0
votes
You can use SCNTransformConstraint to have a blocked called at every frame that takes the node's transform and returns a new transform that satisfies your criteria.
There are conversion utils such as convertPosition:toNode: that will allow you to have the node's position in the coordinate system of the camera, and then back to coordinate system of the node's parent after you modified the y coordinate. Just remember to use the presentation nodes if there are animations, actions or physics in your scene.