Log in or register to post comments

Rotating the 3d model

March 26, 2012 - 4:38am #1

Hi,
I am trying to rotate 3d model by using following code but it is not working.
ShaderUtils::rotatePoseMatrix(60, 1, 0, 0);

I am writing it before
ShaderUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale, &modelViewMatrix.data[0]);
ShaderUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale, &modelViewMatrix.data[0]);

What is the issue?
Thanks
Ayaz Alavi

Rotating the 3d model

July 2, 2013 - 2:52am #9

Not sure what exactly you are trying to do as you have revived a very old thread.

 

 

...image starts from where it previously got ended.  I want the translation to start from the start position. 
 

However it seems as though you just need to set up a variable that holds the start position, and each time it detects for the first time you need to reset the position accordingly.

 

N

 

 

Rotating the 3d model

July 2, 2013 - 12:14am #8

hi,

now i am able to translate the 2d texture with animation.

But what happens is once it starts its translation when the target image is detected, it goes on moving, then after that i change the position of my ipad and then bring back it over the target image, at this time the ytranslation of overlayed image starts from where it previously got ended.

 

I want the translation to start from the start position. 

 

 

 

Rotating the 2d model

July 1, 2013 - 11:33pm #7

Hi,

I am able to rotate a 2d texture image by specifying

 

ShaderUtils::rotatePoseMatrix(rotateBowlAngle, 0.0f, 1.0f, 0.0f,

  &modelViewMatrix.data[0]);

 

but inorder to slide the 2d texture image , we need to use translateposematrix,

so firstly:

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

i am passing the value for x,y and z coordinates as 0.

then inorder to slide i am passing folliwing value:

ShaderUtils::translatePoseMatrix(0.1, 0.1, 0.0);

 

but i am not able to slide the image. Rotation works but translate does not work at all.. Please help 

Re: Rotating the 3d model

March 26, 2012 - 6:39am #6

Glad it was that simple! :-)

Animating any 3D object in OpenGL is all about timers and steps in sequence.

For simple animations just setting the variation on a timer is fine.

If you want to more complex or multiple animations, then it may be well to write a sprite manager that you set up with parameterised movements and objects and let it get on with it. Beyond that you would need to look at Unity or similar gaming engines.

Re: Rotating the 3d model

March 26, 2012 - 6:33am #5

I was completely able to rotate image by following code
ShaderUtils::rotatePoseMatrix(180, 0, 0, 1, &modelViewMatrix.data[0]);

How can I show transition of this rotation? Because currently model simple rotate without any animation transition. What is the best way of doing that.
I was thinking of a timer which updates angle after every 0.1 seconds.Is there any cleaner way?

Re: Rotating the 3d model

March 26, 2012 - 6:09am #4

Sorry, from your snapshot and your request I don't understand what you are asking.

For left to be right and vice-versa you need to reflect your model through a plane? Not rotate?

But the picture seems to have left/right of the augmentation matching the target? Albeit the text is not aligned.

Re: Rotating the 3d model

March 26, 2012 - 5:57am #3

Please find attachment for the output of my code. How can I rotate this model so that left becomes right and right becomes left.

ShaderUtils::rotatePoseMatrix(60, 0, 0, 1, &modelViewMatrix.data[0]); ???

Can you please provide correct values for x, y ,z and angle.

Re: Rotating the 3d model

March 26, 2012 - 5:02am #2

Hi ayazalavi,

I don't know if this is just a C+P error in this post but you're missing the all important 5th parameter?

To confirm, the angle is in degrees, as you have used.

ShaderUtils::rotatePoseMatrix(60, 1, 0, 0, &modelViewMatrix.data[0]);

Log in or register to post comments