I have been experimenting with ARKit and saw that the 4x4 matrix from the ARCamera().transform
property is very lightly documented and was wondering if anyone had any insight into what each column/row in the matrix represented? I was able to gather from the WWDC video that column 3 is for x y and z translations but I wasn't able to find documentation on the rest of the values. Any help figuring this out would be greatly appreciated.
Asked
Active
Viewed 2,028 times
2

jscs
- 63,694
- 13
- 151
- 195

Harry Merzin
- 406
- 1
- 4
- 10
-
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/ – luk2302 Sep 02 '17 at 20:24
-
@luk2302 I read that tutorial, but I wasn't able to find each value of the matrix labeled for what it represents in the context of the world, only what operations can be performed on the values in the identity matrix to change the location/ size/ orientation of the shape – Harry Merzin Sep 02 '17 at 20:41
-
1okay, I do not fully understand, it has been a couple of years since I last had to deal with view matrices. I just wanted to get you started, the tutorial at least contains the right buzz words in case nobody with more knowledge comes around. – luk2302 Sep 02 '17 at 20:43
-
I think I've seen this question before... – rickster Sep 03 '17 at 18:52
-
1Possible duplicate of [What does the different columns in transform in ARKit represent?](https://stackoverflow.com/questions/45437037/what-does-the-different-columns-in-transform-in-arkit-represent) – jlsiewert Sep 04 '17 at 11:52
-
3This questions comes up often, here is a [FAQ for OpenGL](http://www.opengl-tutorial.org/assets/faq_quaternions/index.html) – jlsiewert Sep 04 '17 at 11:53
1 Answers
1
given where the camera is in world coordinates (camera.transform), you may want to then use the identity matrix to access the space just in front (along the z axis) of the camera view (another way is via the camera's projectionMatrix and the hitResult test but that usage demands more complicated matrix maths that still confuse me).
eg
var translation = matrix_identity_float4x4 // this is the magic sauce here
translation.columns.3.z = -1.0
let pos = transform! * translation
let position = SCNVector3(pos.columns.3.x, pos.columns.3.y, pos.columns.3.z)

user3325025
- 654
- 7
- 10