Log in or register to post comments

Moving 3d object using gesture

March 7, 2012 - 5:52am #1

Hi,
I have added my cutom 3d model QCAR AR for android because of ur Help.. thanks:)
now i want to move my object by moving finger on it, Any guide.

Thanks

Re: Moving 3d object using gesture

May 31, 2012 - 10:28am #3

Hi Everybody,

I am trying to do something like on iOS.
My action sequence is the next :
- click on one 3D model since the touchscreen (done thanks to dominoes example).
- click on other position in touchscreen to change position of the selected 3D model (done to but ...).

To change position of my 3D model, i use "ShaderUtils::translatePoseMatrix" method.

First method (test with hard value in code) :
- Model start at x 0 and y 0.
- If i set "translatePoseMatrix" directly, and set x 500 and y 500, model move at a position.

Second method (with touchscreen) :
- Model start at x 0 and y 0.
- Touch the screen at the approximately position of x 500 and y 500 ->
dominoes intersection code return me x : 0.633789 --- y : 0.378906

So, how i can convert this position to use in translatePoseMatrix ?

Thanks

---------------------------
EDIT
---------------------------
I think that i just need to multiply by asset.xml sizes ... ?!

Re: Moving 3d object using gesture

March 7, 2012 - 3:31pm #2

You can look at the Dominoes sample for some sample touch interaction code. The code is pretty application-specific, but it might help you get started.

In general, you capture the touch events in Android and pass them to native. You'll have to write the code to determine if the touch hit a 3D object. This is often called "picking". The Dominoes sample shows you how to do it using object-oriented bounding boxes.

After that, you can use the change in touch position to change the translation of the model.

- Kim

Log in or register to post comments