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
Thank you.
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).
The logic to extract the normal is hidden in the ARCore implementation
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.
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.