"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

touch to rotate & drag 3d object

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

DavidBeard

Sat, 09/14/2013 - 15:24

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