jPCT-AE - a 3d engine for Android > Support

Problem with object picking and modified camera backbuffer matrix

<< < (3/5) > >>

EgonOlsen:
BTW: Is this solution somehow related: http://www.jpct.net/forum2/index.php/topic,1586.msg11938.html#msg11938?

redfalcon:

--- Quote from: EgonOlsen on December 20, 2011, 12:20:55 pm ---If you use a combined matrix as rotation matrix, you'll change the rotation pivot by this translation. The new rotation pivot should be the negative translation.

--- End quote ---

If I set the negative pivot as pivot, the model will instantly snap back to its previous position when trying to rotate it.

I've tried the other solution, but since it uses a different (geographic) coordinate system again, it doesn't work either. The model gets attached to the camera and doesn't stay where it should.

EgonOlsen:
Then go back to this: http://www.jpct.net/forum2/index.php/topic,2461.msg18064.html#msg18064

The problem here seems to be that camera.getPosition() doesn't provide the proper position now that you don't set it correctly but hide it in the matrix. Try to multiply the camera's position with the matrix and use that as the new position.

redfalcon:
I scrapped my approach and now pass the rotation values (from the touchscreen) directly to the pose calculation method. The AR engine provides a method for rotating the pose matrix, so I just pass the values I usually would use for object.rotateX/Y/Z() to the JNI function and rotate the matrix itself.
Thanks anyway!

Vi_O:
Hello,

I am having the same issue than redfalcon and indeed, separating doesn't work.

I made a bit of code to see the difference between normal and rotation/translation separated :


--- Code: ---
_cameraMat.setDump(matrix);
_camera.setBack(_cameraMat);

Log.d("JpctEngine", "Valeur camera : " + _camera.getPosition().x + ";" + _camera.getPosition().y +
";" + _camera.getPosition().z);
Log.d("JpctEngine", "Valeur camera : " + _camera.getXAxis().x + ";" + _camera.getYAxis().x +
";" + _camera.getZAxis().x);

float x = matrix[12]; float y = matrix[13]; float z = matrix[14];
matrix[12] = matrix[13] = matrix[14] = 0;
_cameraMat.setDump(matrix);
_camera.setBack(_cameraMat);
_camera.setPosition(x, y, z);

Log.d("JpctEngine", "Valeur camera : " + _camera.getPosition().x + ";" + _camera.getPosition().y +
";" + _camera.getPosition().z);
Log.d("JpctEngine", "Valeur camera : " + _camera.getXAxis().x + ";" + _camera.getYAxis().x +
";" + _camera.getZAxis().x);

--- End code ---

It is strange because getPosition and get*Axis give the same results for both but the separated one doesn't place the camera well... And still no picking...

From what you were writing there, it is a problem with the getPosition that returns {0.0,0.0,0.0}.

Would it be possible then to extends Camera and Overriding setPosition/getPosition to make the reproject2D3DWS and calcMinDistanceAndObject3D works (assuming it uses getPosition to work) ?

I can't test it now as I don't have my source right now, but i'll try tomorrow if you don't tell me it is useless before :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version