I want to give an experience to the end user similar to the Stack AR game initial screen,
Where user can move a small tile which sticks to the detected surface and when he is ready he taps on it to start the game. In the UnityARKit Scene example I see a cube is placed on user’s tap, where should I tweak the code to give this StackAR user experience?
I will answer my question. This is how I solved this. In the Update function of UnityARKitHitTestExample change to this code
{
var screenPosition = Camera.main.ScreenToViewportPoint(new Vector2(Screen.width/2,Screen.height/2));
ARPoint point = new ARPoint {
x = screenPosition.x,
y = screenPosition.y
};
// prioritize reults types
ARHitTestResultType[] resultTypes = {
ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingExtent,
// if you want to use infinite planes use this:
//ARHitTestResultType.ARHitTestResultTypeExistingPlane,
// ARHitTestResultType.ARHitTestResultTypeHorizontalPlane,
//ARHitTestResultType.ARHitTestResultTypeFeaturePoint
};
foreach (ARHitTestResultType resultType in resultTypes)
{
if (HitTestWithResultType (point, resultType))
{
return;
}
}
}
Hi,
Thanks for sharing it works well,
How can I implement the click to start that fix the position of the tile when clicking
How can I detect that the user is not facing a plane surface to display an information message
Thanks,Hi,
Thanks for sharing it works well
How can I implement the click to start, and also to detect when the user is not facing a plane surface to put a message “Scan a flat surface”