Log in or register to post comments

3D model positioning

April 2, 2013 - 2:27pm #1

Hi,

I have recently been adding to and updating my AR project based on the Image Targets app.

I have changed it so now a new 3d model is loaded and you can play a sound on a tap which is awesome for me :)

The question I have is that my 3d model is laying on his back....I need him standing up really unless he is dead.

Any idea how I can do this? the .h file created from the .obj file only gave me verticies nothing else, im thinking this may be the problem?

Any help will be amazing :)

Thanks,

Harry

3D model positioning

April 4, 2013 - 5:25am #3

Hi Alessandro,

Im not at home at the mo so can't test but this looks to be the puppy.

Thanks for your help!

 

3D model positioning

April 2, 2013 - 10:35pm #2

Hi,

in your rendering function, you should see some code like this:

QCAR::Matrix44F modelViewProjection;

SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale,
                                 &modelViewMatrix.data[0]);

SampleUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale,
                                     &modelViewMatrix.data[0]);
SampleUtils::multiplyMatrix(&projectionMatrix.data[0],
                            &modelViewMatrix.data[0] ,
                            &modelViewProjection.data[0]);

You can modify it as follows (so to add a rotation of 90 degrees around the X axis for instance...or alternatively around the Y axis if you prefer, depending on the side your model is laying on):

 

QCAR::Matrix44F modelViewProjection;

SampleUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale,
                                 &modelViewMatrix.data[0]);

float angle = 90.0f; // angle in degrees
SampleUtils::rotatePoseMatrix(angle, 1.0f, 0.0f, 0.0f,
                                     &modelViewMatrix.data[0]);

SampleUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale,
                             &modelViewMatrix.data[0]);
SampleUtils::multiplyMatrix(&projectionMatrix.data[0],
                            &modelViewMatrix.data[0] ,
                            &modelViewProjection.data[0]);

 

I hope this helps.

Log in or register to post comments