I've placed a node in Scenekit/ARKit
Now I want to move node/object to right and left with help of buttons. Issue is when I moves my camera/device and press right button, node moves in direction of axis it was first initiated, Not moves right with respect to camera. How can I achieve this?
current code on tapping right button
position.x += 0.2
Here is the solution
guard let front = sceneView.pointOfView?.simdWorldFront else {return}
let horazontalRight = cross(front, simd_float3(0,1,0))
// for moving right
node.position += SCNVector3(horazontalRight * 0.01)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.