Log in or register to post comments

touch to rotate & drag 3d object

September 14, 2013 - 4:30am #1

Hi,

I am using frame-marker sample app. I have multiple 3d objects.

My question is here "How can i rotate a 3d-model and how can i drag the 3D model from one to an other position".

for translation i am using this code but this is doing translation automatically i need to translate object using touch event.

 

/*

void

computeTargetTranslationFromScreenVector(float screenDeltaX, float screenDeltaY,

                                         QCAR::Matrix44F & modelViewMatrix, QCAR::Vec3F & result)

{

    QCAR::Vec3F screenAlignedDisplacement;

    screenAlignedDisplacement.data[0] = screenDeltaX;

    screenAlignedDisplacement.data[1] = screenDeltaY;

    screenAlignedDisplacement.data[2] = 0.0f;

    

    // Compute matrix to pass from Eye Coordinates to Object Coordinates

    QCAR::Matrix44F inverseModelViewMatrix =

    SampleMath::Matrix44FInverse(modelViewMatrix);

    

    // Convert the screen-aligned displacement vector to Object Coordinates

    // (i.e. in the target local reference frame)

    QCAR::Vec3F localTargetDisplacement = SampleMath::Vec3FTransformNormal(

                                                                           screenAlignedDisplacement, inverseModelViewMatrix);

    

    // Compute a speed factor based on the distance of the target from the camera

    float distanceObjectToCamera = fabs(modelViewMatrix.data[14]);

    float speed = 0.001f * distanceObjectToCamera;// TODO adjust value to your needs

    

    // set the result taking the speed factor into account

    result.data[0] = speed * localTargetDisplacement.data[0];

    result.data[1] = speed * localTargetDisplacement.data[1];

    result.data[2] = speed * localTargetDisplacement.data[2];

}*/

kindly give me suggestions.
Thanks

touch to rotate & drag 3d object

September 16, 2013 - 3:48am #6

It's free, just like Unity Basic on iOS and Android :)

N

touch to rotate & drag 3d object

September 16, 2013 - 3:30am #5

Is unity SDK is free to use or i have to purchase it's licence ?

touch to rotate & drag 3d object

September 16, 2013 - 2:39am #4

This is much easier to do in Unity, which is why we provide the Unity SDK so you might like to try it.

Doing this in native is much more involved and needs more expertise in maths and OpenGL ES.

 

N

touch to rotate & drag 3d object

September 16, 2013 - 1:39am #3

Dear @DavidBeard i have consulted dominoes app but i am able to do just zooming wd it not rotation. and another thing is that i dont want it with touch i want it with pinch gesture recognizor any help will be very greatfull.....

touch to rotate & drag 3d object

September 14, 2013 - 8:24am #2

The Dominoes sample demonstrates how to handle and locate touches and strokes - https://developer.vuforia.com/resources/sample-apps/dominos-sample-app

Log in or register to post comments