简体   繁体   中英

Making Virtual Object Interactive with Mobile's Touch Input - Augmented Reality

I want to develop an augmented reality application for android that is capable of using markers to generate 3D objects and these 3D objects are interactive upon touch using the mobile's touch input.

I have browsed through the available SDKs like Vuforia , Junaio or Layar Player and found that they all support:

  • Marker detection with 3D virtual image overlay
  • Virtual buttons that get active when you make them invisible. (Vuforia)
  • Interactive video playback.

However, what I am looking for is:

  • Virtual object in AR that can be made interactive using mobile's touch.

I am pretty sure it is possible, as there are virtual video overlays that upon clicking/tap would start a video (similar to an interactive virtual element).

Q. Could someone suggest a library/toolkit best suited for this functionality that I'm looking for?

or

Q. Is there something that I apparently missed during my search with the aforementioned toolkits that already support the functionality I want?

According to your last description, what you need is supported by Vuforia, and there is a sample for pure Android (no Unity) as well.

You need to look at the Dominos sample, where they show how to drag an OpenGL domino object on the screen. Look here for a quick description: https://developer.vuforia.com/forum/faq/android-how-do-i-project-screen-touch-target

In case you run into some problems while trying to implement it yourself, you can search at the Vuforia forums for some answers to common problems others have faced with this. But basically, it works well in their sample.

Well, this is for Unity 5.x

First, go through Vuforia's Documentation to know more about Image Targets and AR Camera .

Import your 3D models to the scene so that all interactive objects are a child of the image target.

Read touch on mobile phone (I used android for my project)

if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)

Convert touch point into a ray from the screen into the 3D world

Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);

Create a plane in the scene (for the ray to hit)

Plane plane = new Plane(Vector3.up, Vector3.zero);

If, the ray hits the plane, get the x,y,z position. Value of pos will have the world position

if (plane.Raycast(ray, out distance)){
    Vector3 pos = ray.GetPoint(distance); 
}

Please modify the code according to your need. This is a very basic example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM