ARKit Place a SCNNode facing the camera

前端 未结 6 2017
挽巷
挽巷 2021-02-02 00:15

I\'m using ARKit to display 3D objects. I managed to place the nodes in the real world in front of the user (aka the camera). But I don\'t manage to make them to fa

6条回答
  •  醉梦人生
    2021-02-02 00:49

    Do you want the nodes to always face the camera, even as the camera moves? That's what SceneKit constraints are for. Either SCNLookAtConstraint or SCNBillboardConstraint can keep a node always pointing at the camera.

    Do you want the node to face the camera when placed, but then hold still (so you can move the camera around and see the back of it)? There are a few ways to do that. Some involve fun math, but a simpler way to handle it might just be to design your 3D assets so that "front" is always in the positive Z-axis direction. Set a placed object's transform based on the camera transform, and its initial orientation will match the camera's.

提交回复
热议问题