Thanks Infaust, I found the option to change the up and forward directions on Blender before you export it to a .obj file. The rotation is perfect now.
But the size doesn't seem to be doing anything. I've set it up so that is shows the metric measurements (cm, m, km) and it showed that my model was a couple of m's in the dimensions but it was still very small when it came up on the trackable. I'm using the default stones trackable for testing. I've tried to change the scale variable on both the build window and on the export window.
Well, nevermind the stuff below, which I'll leave on for reference, but it seemed that the slow rotation works if you put the static double prevTime = getCurrentTime(); inside the function. I didn't try this earlier because of the prevTime = time; . It seemed weird to have that line as both prevTime and time were being initialized and set everytime the function was being called, but I can see why setting them up each time helps the slow rotation as the rotation angle increases slower.
---Older post left for reference---
Also, I'm having troubles with stopping the rotation of the matrix at a certain angle. If I want the rotation to stop when the angle is 90 degrees, I have it set so that if the rotateBowlAngle goes over 90 it is fixed to back to 90. But what I see is a short duration of slow rotation as it should look like but then it is instantly changed to the 90 degree rotation. I'm guessing it has something to do with the rotation over time but I can't figure it out. Here is my code:
void
animateBowl(QCAR::Matrix44F& modelViewMatrix)
{
double time = getCurrentTime(); // Get real time difference
float dt = (float)(time-prevTime); // from frame to frame
if(rotateBowlAngle < 90.0f) <- To check for angle
rotateBowlAngle += dt * 180.0f/3.1415f; // Animate angle based on time
if(rotateBowlAngle > 90.0f) <- if it goes over 90 set it to 90
rotateBowlAngle = 90.0f; &modelViewMatrix.data[0]);
SampleUtils::rotatePoseMatrix(rotateBowlAngle, 1.0f, 0.0f, 0.0f,
&modelViewMatrix.data[0]);
prevTime = time;
}
This does make the model rotate the 90 and stop, but does it instantly instead of the slow rotation.
We don't provide support for external scripts. That said, you should be able to open your .obj file with a text editor and make sure the texcoords and normals are in there. In Blender, you might have to check a box somewhere on export to include these.
Note that our sample code doesn't really make use of the normals, so you can probably leave those out. The texcoords are important, however.
- Kim