1
Support / Problem with object picking and modified camera backbuffer matrix
« on: December 15, 2011, 03:40:51 pm »
Hi,
I'm currently developing an AR-App and use jPCT-ae for rendering. To affix the model on a marker I receive a pose matrix and apply her to the camera with camera.setBack(). This works for putting my model on the marker, but I can't get picking to work with it. If I just render my model without changing the camera matrix it works fine, but as soon as I change her, it doesn't work anymore (calcMinDistanceAndObject3D() returns everywhere on my object COLLISION_NONE). Since the picking needs the camera position, I assume that something with the position vector is wrong.
My picking code:
Object properties:
Camera pose setting:
Any idea why that is?
I'm currently developing an AR-App and use jPCT-ae for rendering. To affix the model on a marker I receive a pose matrix and apply her to the camera with camera.setBack(). This works for putting my model on the marker, but I can't get picking to work with it. If I just render my model without changing the camera matrix it works fine, but as soon as I change her, it doesn't work anymore (calcMinDistanceAndObject3D() returns everywhere on my object COLLISION_NONE). Since the picking needs the camera position, I assume that something with the position vector is wrong.
My picking code:
Code: [Select]
private void doPicking(int touchX, int touchY){
SimpleVector dir = Interact2D.reproject2D3DWS(camera, frameBuffer, touchX, touchY).normalize();
Object[] res = world.calcMinDistanceAndObject3D(camera.getPosition(), dir, 10000);
if (res[1] != null) {
//do something...
}
}
Object properties:
Code: [Select]
Object3D[] serializedObject = Loader.loadSerializedObjectArray(serializedInputStream);
for (int i = 0; i < serializedObject.length; i++) {
serializedObject[i].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
if (i > 0) serializedObject[i].addParent(serializedObject[0]);
serializedObject[i].strip();
}
Camera pose setting:
Code: [Select]
public void onDrawFrame(GL10 arg0) {
//...
float[] matrix = getMatrixForJPCT(new float[16]);
Matrix mat = new Matrix();
mat.setDump(matrix);
//If I comment this out, picking works flawless:
camera.setBack(mat);
//...
}
Any idea why that is?