Sceneform-android-sdk: Positioning object on a Point

Created on 2 Jul 2018  路  5Comments  路  Source: google-ar/sceneform-android-sdk

Placing object on a Point requires some understanding of how it's Pose is calculated.

In the image below is the situation when I place object on a Point.
Rotated around X

  1. What is the logic behind this transformation?
  2. How to calculate position if it would be placed on the Plane?

Thank you.

question

Most helpful comment

I think the simplest solution is to have
AnchorNode -> Node -> Andy

AnchorNode might periodically update its position from ARCore. The middle node will keep the position of the AnchorNode, but undo the orientation. The default quaternion constructor should be the identity. Then you can apply local transforms to Andy if you want.

All 5 comments

A point anchor has an orientation mode that's either a surface normal or identity. I believe the one in your image is oriented along what ARCore believes is the surface normal on your display (and looks reasonably accurate).

  1. The logic to extract the normal is hidden in the ARCore implementation

  2. The position is provided in the pose when placed on a plane. You can get poses on planes by either filtering hit results on the plane, or by enumerating the available planes ARCore is tracking, and working with their representation.

Thanks!

I'm trying to place an object in designated location but with it's own orientation not bound to a point's orientation, not considering a plane either. Real world objects are non-planar: bottle, mug, etc.
Is there a way to do it?

From what you say I got is I have to figure out the point orientation, and in case the point is surface normal I have to skip it. Otherwise it will provide unexpected position of my object.

Also, if a point in the area of a tap is not of my type I have to look for the nearest point, btw is there a method to get nearest points to a tap?

Regarding orienting your point: in this example, would you want the Andy model to be facing up? You can do that by adding an extra node to the AnchorNode, and perhaps call setWorldRotation with an identity value. The idea is to undo the transform of the parent node.

Yes, I'd like Andy model facing up.
And when I add extra node, should Andy be the child of this node?
If a Point has it's own orientation space what would the identity value in this case?
And the value should be applied to the parent Node, right?

I think the simplest solution is to have
AnchorNode -> Node -> Andy

AnchorNode might periodically update its position from ARCore. The middle node will keep the position of the AnchorNode, but undo the orientation. The default quaternion constructor should be the identity. Then you can apply local transforms to Andy if you want.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Brian-Kwon picture Brian-Kwon  路  3Comments

khonakr picture khonakr  路  3Comments

arilotter picture arilotter  路  3Comments

PaulTVungle picture PaulTVungle  路  3Comments

chiaolinghong3d picture chiaolinghong3d  路  3Comments