Latest reply on Feb 15, 2018 6:29 PM by justingaynor
Level 1 (0 points)

I am using ARKit 1.5 beta to detect vertical plane. How can I go about finding the orientation of detected vertical plane?

By orientation, I am referring to the rotational angle around y-axis, since vertical plane is paralel to gravity and perpendicular to the x-z plane.

I have tried the following method:

```// point1 and point 2 are 2 points on the vertical plane I found by performing hit-test with 3d coordinates relative to the world coordinate system
let vector : SCNVector3 = point1 - point2
let projection = SCNVector3Make(vector.x, 0.0, vector.z).normalized() // project vector onto x-z plane
let xVector = SCNVector3Make(1, 0, 0)
let angle = xVector.angleBetweenVectors(projection)
```

```func angleBetweenVectors(_ vectorB:SCNVector3) -> Float {
let cosineAngle = (dotProduct(vectorB) / (magnitude * vectorB.magnitude))
return Float(acos(cosineAngle))
}
```

This method does not give me the correct orientation. I also wonder if I can find orientation through anchor.worldTransform.

• ###### Re: Vertical Plane Orientation
Level 1 (0 points)

I am also looking for help with this issue. Any suggestions are appreciated. I'm able to detect vertical planes and attach nodes to them, but in the case of placing a flat object like a photo or video the plane I'm not entirely sure how to rotate/angle the node to match the detected plane.