Log in or register to post comments

Interact control 3D model

July 22, 2013 - 2:23am #1

Hi i am a new Vuforia developer. I would like to design an app which allow user to rotate/zoom in and out for the 3D model. Anyone have idea how to achieve this? Please help.

Interact control 3D model

July 24, 2013 - 4:39am #8

You're welcome

Interact control 3D model

July 24, 2013 - 3:29am #7

Thank you very much. It works now.

Interact control 3D model

July 24, 2013 - 2:57am #6

You are trying to set the pose matrix in the _nativeTapEvent() function, but this will be useless, since the _renderFrame() method will then override your modelview matrix;

you need to pass the relevant drag information to C++ (for instance using the nativeTapEvent() function), then store those information in some global variables and then perform your custom rotation in the _renderFrame() function (by adjusting the existing code).

Note: this is just about programming....

 

Interact control 3D model

July 24, 2013 - 1:56am #5

Hi, i use this method, but it is not working. can you tell me why? 

this is ImageTargets.cpp:

JNIEXPORT int JNICALL
Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_nativeTapEvent(JNIEnv *, jobject, jfloat x, jfloat y)
{
QCAR::Matrix44F modelViewProjection;
SampleUtils::translatePoseMatrix(10.0f, 10.0f, kObjectScale,&modelViewMatrix.data[0]);
SampleUtils::rotatePoseMatrix(x, 1.0f, 0.0f, 0.0f, &modelViewMatrix.data[0]);
SampleUtils::rotatePoseMatrix(y, 0.0f, 1.0f, 0.0f, &modelViewMatrix.data[0]);
SampleUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale,&modelViewMatrix.data[0]);
}
 
This is ImageTargets.java:
private native boolean nativeTapEvent(float tapX, float tapY);
    
    /**
     * Process Double Tap event for showing the Camera options menu
     */
    
    private class TapGestureListener extends GestureDetector.SimpleOnGestureListener
    {
        public boolean onDown(MotionEvent e)
        {
            return true;
        }
 
        public boolean onSingleTapUp(MotionEvent e)
        {
           float x=e.getX();
           float y=e.getY();  
           nativeTapEvent(x, y);
            return true;
        }
}
 
I pass the value from java to c++ through nativeTapEvent function. Please help me to check it. thank you very much.
 

Interact control 3D model

July 23, 2013 - 11:20pm #4

Hi, to do that you need to handle the touch events in the Java code (see existing code in ImageTargets.java, where some code already exists t handle touch events), and then pass the values to the C++ layer via JNI, as explained here:

https://developer.vuforia.com/forum/faq/android-how-can-i-call-c-methods-java

in C++ you can rotate the 3d model by adjusting the code in the _renderFrame() function;

this article explains how to rotate the teapot model in the ImageTargets sample:

https://developer.vuforia.com/forum/faq/android-how-can-i-rotate-teapot

 

Interact control 3D model

July 23, 2013 - 9:44pm #3

Currently i successfully modify the ImageTarget teapot model to my own 3D model, now i want the 3D model can be controlled with touch input. I would like to achieve this effect http://www.youtube.com/watch?feature=player_embedded&v=0URpA8LPotk please check out this link. I already tried different methods, but i still haven't solve this problem. I really need your help. Thank you very much.

Interact control 3D model

July 22, 2013 - 3:18am #2

Hi,

your question is very broad and too generic; could you be more specific ?

then, reading the developer guide will help you understand the concepts and how-tos involved in Vuforia.

https://developer.vuforia.com/resources/dev-guide/getting-started

also, in general, the best is to start by looking at the samples, in particular the ImageTargets sample;

Log in or register to post comments