Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move an SCNNode to just below ARCamera?

I'm making an Augmented Reality app where the user has to throw a ball at a target. I used the following code to position the ball 10 cm in front of the screen:

var translation = matrix_identity_float4x4
translation.columns.3.z = -0.1
print(translation.debugDescription)
print(frame.camera.transform)
projectile.simdTransform = matrix_multiply(frame.camera.transform, translation)

Currently the game looks like this, but I want to move the ball to near the bottom of the screen.

enter image description here

like image 790
ymulki Avatar asked Sep 30 '17 19:09

ymulki


1 Answers

I ended up finding a solution:

Replacing the following line:

translation.columns.3.z = -0.1

with:

translation.columns.3.x = -0.1
like image 164
ymulki Avatar answered Oct 19 '22 23:10

ymulki