picking to 3d coordinate

Started by Vertigo, April 18, 2004, 07:15:40 PM

Previous topic - Next topic

Vertigo

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 ?

EgonOlsen

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

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

some research turned out it to be the # triangle added - without zerosizetriangles (and maybe other other unnessescary triangles :)  )

EgonOlsen

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.