问题
I am trying to build an app based on ARKit to place 3D virtual objects on to the plane that is detected. I found a useful project on GitHub Placing Virtual Objects
This does the job exactly what I am looking for. However, when any virtual object is placed in front of the camera, it may or may not face the camera. Sometimes 3D objects look in the opposite direction of camera
I have tried to add SCNconstraints to virtual object node and tweak the rotation and orientation of 3D Models to look at the camera when placed. Nothing seems to be working.
Below code works while placing the object in the scene. However, the object rotates when the camera is moved back and forth. I want to disable this after object has been placed
let yFreeConstraint = SCNBillboardConstraint()
yFreeConstraint.freeAxes = .Y // optionally
object.constraints = [yFreeConstraint]
It would be a great help if someone can crack this down!
来源:https://stackoverflow.com/questions/47579083/arkit-make-virtual-3d-objects-to-point-towards-camera