www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: tony-kun on February 22, 2009, 12:00:57 am

Title: how to obtain selected triangle
Post by: tony-kun on February 22, 2009, 12:00:57 am
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.
Title: Re: how to obtain selected triangle
Post by: EgonOlsen on February 22, 2009, 08:22:08 am
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.
Title: Re: how to obtain selected triangle
Post by: tony-kun on February 22, 2009, 03:34:29 pm
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.
Title: Re: how to obtain selected triangle
Post by: tony-kun on February 22, 2009, 03:52:33 pm
Aaah may be I can do really exactly what I said, great. Anyway thanks for any aditional help.
Title: Re: how to obtain selected triangle
Post by: tony-kun on February 23, 2009, 04:33:43 am
am sorry the flood already. Actually I can use what you said too.

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

thanks.
Title: Re: how to obtain selected triangle
Post by: EgonOlsen on February 23, 2009, 07:18:34 am
the polygons used by jpct are always convex? or not?
They are always triangles... ;D