Author Topic: picking to 3d coordinate  (Read 4631 times)

Vertigo

  • Guest
picking to 3d coordinate
« on: April 18, 2004, 07:15:40 pm »
hello alltogether,

 i'am trying to pick a 2d coordinate (displays a 2d board in 3d ,  now need to pick a square)
 i have investigated interface2d and seen a way,
 screenx,screeny to 3dpoint() now pickpolygon,
 but alas i cant find a way to get the polygon !

i just need the intersection point of an object with an ray
maybe there is a slimmer way ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
picking to 3d coordinate
« Reply #1 on: April 18, 2004, 10:11:04 pm »
You can get the polygon number by throwing the result of pickPolygon into getPolygonNumber(int[]). What you won't get ATM is the intersection point. Do you really need this information?

Anonymous

  • Guest
picking to 3d coordinate
« Reply #2 on: April 18, 2004, 11:20:40 pm »
the intersection point would translate directly to the squares,
but it would work with polygons,
but how relates polygon number to polyons ?
is polygon number 3 the third triangle i added, (without makestrips )
?

Anonymous

  • Guest
picking to 3d coordinate
« Reply #3 on: April 19, 2004, 12:27:50 am »
some research turned out it to be the # triangle added - without zerosizetriangles (and maybe other other unnessescary triangles :)  )

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
picking to 3d coordinate
« Reply #4 on: April 19, 2004, 10:47:21 pm »
Quote from: "Anonymous"
some research turned out it to be the # triangle added - without zerosizetriangles (and maybe other other unnessescary triangles :)  )
Yes, that's the way jPCT behaves. I could say "at the moment" and that this behaviour may change sometimes...but that won't be the case...it's pretty save to rely on this behaviour.
However, a better solution would be to make each tile of the board an individual object. The overhead introduced by this should be neglectable as long as the board doesn't consist of thousands of tiles. That's much more flexible and allows to implement additional effects easier (like letting the board "explode" or something like that).
jPCT is mostly object based, not triangle based. I'll add some addional stuff for handling objects on the triangle level better in the next release, but its main focus are still objects.