Log in or register to post comments

Android - Tap on 3D object and open 2D object by exiting from camera

February 22, 2013 - 5:11am #1


   I want to tap on 3D object and close camera + open a 2D object.

  I need help in finding touch on 3D object. I stuck at i could not get how can i get matrix points of 3D object that is place on cameara view.  Till now i get topuch point from java to native but all tries works on whole screen cordinates or target place vertises.... from them i am not able to decide on which vertices 3D object is placed.

  So any help to make understanding this concept of 3D projection ,its vertices value.  Or any hint to tap object by another logic.

  I have gone thoru : https://developer.vuforia.com/forum/ios/getting-touch-event-3d-model   But in this concept  to drop domino at position of your 3d object - i dont know how to get 3D object position.  N all are for iphone...



Android - Tap on 3D object and open 2D object by exiting from ca

February 22, 2013 - 6:16am #2


your best bet here is to look at the following code in Dominoes.cpp (Dominoes sample for Androdi):

    // If there is a new tap that we haven't handled yet:
    if (touch1.didTap && touch1.startTime > lastTapTime) {

That sample code demonstrates how you can intercept a point in 3D space on the image target plane, starting from a point in screen coordinates; that would be a good starting point for your case;

However, you should be aware that being able to touch a 3D object (with arbitrary shape, i.e. not just a sphere or a quad) by programming in native Android and OpenGL will require a fairly involved programming process; 

the complexity comes from the fact that you will need to implement a raycasting algorithm that checks and computes the possible intersection of a ray (cast from the camera point of view) through the large set of polygons (triangles) that are making up your 3D object (mesh).

This can certainly be done, but advising on the implementation of a raycasting algorithm is far beyond the scope of this Forum (and it would require really a large amount of C++ code).

If you really want to implement such a thing, my strong advise would be to choose one of these options:

  1. Integrate an existing 3D game engine (or rendering engine) for Android, already supporting then raycasting feature out-of-the-box
  2. Use Unity3D with the Vuforia extension for Unity, instead of programming natively (this is the recommended option)

​I hope this helps.


Log in or register to post comments