Author Topic: How could I pickPolygon behind some transparent faces?  (Read 3455 times)

Offline pitt

  • byte
  • *
  • Posts: 13
    • View Profile
How could I pickPolygon behind some transparent faces?
« on: March 23, 2006, 04:27:32 am »
Hi,

     I want to pick the terrain face. But, what if there are some transparent faces like smoke over that terrain face. How could I pickPolygon behind that transparent faces? If i disable the mouse selectable of those transparent faces, pickPolygon'll return null not the terrain face behind them. I try to use reproject2D3D with z by adding more z to avoid that transparent faces. But, I don't know how much z to set to avoid them cause my terrain is not flat. For example, i give z=0 then call pickPolygon and check that the returned face is the terrain face. If not, I add more z for reproject2D3D then call pickPolygon again until I get null or the terrain face. Sometimes, it miss the terrain face! I think it's not good that pickPolygon has to be called again and again as well. Any other way?
         
Thank you.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
How could I pickPolygon behind some transparent faces?
« Reply #1 on: March 23, 2006, 06:28:22 pm »
I see...that's obviously something that i haven't thought of yet. But it's never too late, so here is a new jar for you to try: http://www.jpct.net/download/beta/jpct_111pre3.jar

It adds two new variants of pickPolygon, each with an additional boolean parameter which, if set to true, should exclude transparent polygons from the calculation. But i haven't tested this, so please tell me if it works or not.

Offline pitt

  • byte
  • *
  • Posts: 13
    • View Profile
How could I pickPolygon behind some transparent faces?
« Reply #2 on: March 24, 2006, 02:26:57 am »
Thank you very much!!  :D
It works.

I suggest that not just transparent objects to be extruded.
To generalize the pickPolygon, those mouse unselectable objects should be extruded too.
Some cases like unuseable weapon or corpse drop on the ground need it.

I might need it in the future.  :wink:

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
How could I pickPolygon behind some transparent faces?
« Reply #3 on: March 24, 2006, 05:08:59 pm »
Quote from: "pitt"

I suggest that not just transparent objects to be extruded.
To generalize the pickPolygon, those mouse unselectable objects should be extruded too.
Agreed. I think i'll change the boolean to an int where one can "or" some flags that indicate what should be excluded.