Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - redfalcon

#1
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:


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:


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:



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?
#2
Support / Getting the pose of the camera?
November 15, 2011, 10:16:07 AM
Hello,

is it possible to get the pose of the camera? I tried getting the backbuffer matrix with getBack(), but that doesn't seem to be the same. If I apply e.g. a translation on the camera, the backbuffer matrix will remain the same as before the transformation.
#3
Support / Getting Sub-Objects from *.obj file?
October 12, 2011, 12:03:47 PM
Hi.

I'm loading a Wavefront obj file, that consists of serveral sub-objects (I noticed that jpct processes each of these objects when compiling). Using the picking tutorial from the wiki, I can now successfully choose between the objects I have in my scene with the touchscreen. It would now be interesting to somehow access (like adding transparency, or removing them temporarily) these sub-objects. I found that I can create a PolygonManager from the object, but it doesn't seem to help me, because I can only manipulate the polygons (duh). Is there any way to get access to the sub-objects in jpct?