www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: pitt on March 01, 2006, 04:57:54 am

Title: Interact2D.pickPolygon problem
Post by: pitt on March 01, 2006, 04:57:54 am
Hi,

  SimpleVector temp=Interact2D.reproject2D3D(camera,buffer,x,y);
  int[] polygon=Interact2D.pickPolygon(world.getVisibilityList(),temp);
       
  if (polygon!=null)
  {
    PolygonManager poly=world.getObject(polygon[1]).getPolygonManager();
    int u=poly.getMaxPolygonID();
  }

in some cases, I found that u<polygon[0]. worse, polygon[0]<0! How is it possible?

Those objects in the world loaded from .3ds. This is it.

 for (int i=0;i<scene.length;i++)
 {
   scene.createTriangleStrips(2);
   scene.setCollisionOptimization(true);          
   scene.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
   scene.enableLazyTransformations();
   scene.build();
   world.addObject(scene);
 }

I tried to merge the scene together. But, I still get the same result.
Thank you.
Title: Interact2D.pickPolygon problem
Post by: EgonOlsen on March 01, 2006, 06:10:13 pm
The docs are misleading for this method (i'll change it in the next release), because they sound as if the order is "polygon, object" where in fact it's "object, polygon". Use the getPolygonID() and getObjectID()-methods in Interact2D instead of accessing the array directly to be sure. The array is just a cheap hack to avoid an extra class for such a trivial information...i guess it bites me now for being that lazy... :wink: