how to obtain selected triangle

Started by tony-kun, February 22, 2009, 12:00:57 AM

Previous topic - Next topic

tony-kun

Hi! I will get fun starting a 3d game project. jcpt is the first engine am trying and looks very nice all this. Not worrying about the 3d stuff and filling textures so easly is so great.. But one thing I miss is obtaining the original triangle of a 2d position in the screen. Something like:

int idTriangle = Interact2D.getTriangleID(r);

off course triangles when adding them they should have an unique global id in addittion to just a local to the object.

May be am missing something. Otherwise, how do you know which face of an object the user points to?

A drastic solution could be definind an object for every face. But I don't think that's normal.

Many thanks for any help.

EgonOlsen

Interact2D.pickPolygon(...) returns the polygon's ID. With that, you can use the PolygonManager to access texture-, normal- and transformed 3D coordinates of that polygon. Maybe that helps.

tony-kun

Hi, as I understand polygon is what get displayed at the end, a portion of the triangle, and may be even all of his vertices are new.
May be if I had a function that tell me if a polygon is aproximately inside the coords I give... that could suffice, altough would be a bit inexact. Is there something like that?

I suposse you don't give the id of the original triangles because some optimization.

Thanks.

tony-kun

Aaah may be I can do really exactly what I said, great. Anyway thanks for any aditional help.

tony-kun

am sorry the flood already. Actually I can use what you said too.

the polygons used by jpct are always convex? or not?

thanks.

EgonOlsen

Quote from: tony-kun on February 23, 2009, 04:33:43 AM
the polygons used by jpct are always convex? or not?
They are always triangles... ;D