I am writing an application using ArCore. I am getting an object's pose as a Hitresult, therefore the object is placed correctly in the plane, but not correctly orientated/rotated towards the smartphone. For a more complete problem description: The object is a 2d rectangle and is intended to stay inside the plane (= same normal vectors). The rectangle also needs to "point" to the camera (= nearest border needs to be aligned with the smartphone screen).
currentObstaclePose = hit.getHitPose().extractTranslation().compose(frame.getCamera().getPose().extractRotation())
Using this approach I do not get matching normal vectors for object and plane.
I have no idea how to construct the objects quaternions in a manner to achieve my goal. Thanks in advance for your help.
It sounds like you want to set the 'look direction' of the renderable.
Assuming you are using Scenefrom, which I see is tagged, you can use a TransformableNode and the method setLookDirection.
The example below will set the direction of the renderable, depending on the value you set for lookDirection: