So this is the code I'm using to get all the feature planes.
while (planeIterator.hasNext()){
Plane plane = planeIterator.next();
if(plane.getTrackingState() == TrackingState.TRACKING &&
(plane.getType() == Plane.Type.VERTICAL||plane.getType() == Plane.Type.HORIZONTAL_UPWARD_FACING)){
Iterator<Anchor> anchors = frame.getUpdatedAnchors().iterator();
Anchor newAnchor = plane.createAnchor(plane.getCenterPose());
}
}
It's not clear from the documentation how to get the 3d world coordinates from the anchor. If I could get that 3d world coordinate, I could convert to 2D using
ArFragment.getArSceneView().getScene().getCamera().worldToScreenPoint()
But how do you get the 3D world to co-ordinate from the newAnchor
?
I think you are asking for the pose of the anchor - this is available from the getPose() method:
public Pose getPose ()
Returns the pose of the anchor in the world coordinate space.
Pose is defined as the mapping of an object for its local co-ordinates, ie if you just look at the object itself, into the world co-ordinates. It is usually described as a rotation followed by a translation. The rotation gets the object pointing the right way, or orientated correctly, and then the translation moves it to the correct place in the world co-ordinates.
If you look at the Pose class you can query whatever information you need for your use case from it.
One quick note - I am guessing you are aware but Sceneform is no deprecated, or more accurately open sourced and then archived - see here: https://developers.google.com/sceneform/develop .
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.