Open
Description
The QR Code Tracking sample while positionally accurate struggles to match the rotation of the QR code which may be important to some use cases. You can very easily improve the sample by sampling each corner with the environmental raycast manager. Here is the code:
for (var i = 0; i < count; i++)
{
var pixelCoord = new Vector2Int(
Mathf.RoundToInt(uvs[i].x * intrinsics.Resolution.x),
Mathf.RoundToInt(uvs[i].y * intrinsics.Resolution.y)
);
var r = PassthroughCameraUtils.ScreenPointToRayInWorld(_passthroughCameraEye, pixelCoord);
if (!envRaycastManager || !envRaycastManager.Raycast(r, out var cornerHitInfo))
{
tempCorners[i] = r.origin + r.direction * distance;
}
else {
tempCorners[i] = cornerHitInfo.point;
}
}
Metadata
Metadata
Assignees
Labels
No labels