Dragging SCNNode in ARKit Using SceneKit

前端 未结 3 630
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 11:45

I have a simple SCNNode in ARKit and I am trying to drag it wherever I moved my finger on the phone. Here is my code.

 @objc func pan(recognizer :UIGestureR         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 12:26

    I had a similar problem. Whilst you should use John's advice in the comments and use the pan gesture states correct (Began, Changed, Ended), I think the issue might be that you are grabbing the hitResult.node when you should be grabbing the parent of the node, or even the parent's parent, etc... I've had this issue and ended up fixing it by going up parent levels until the entire object was being selected instead of a part of it.

提交回复
热议问题