Question

I'm trying to create my own Java3D shape and in this case I just want a 3D triangle. I've made it using a TriangleArray of 3 points and turning it into a Shape3D object and got it displaying, however it's only visible from one angle. When I rotate the view, so that the other side is facing the camera, it isn't visible.

I know this is probably something relatively simple but unfortunately I'm struggling to figure it out as I'd rather my shapes are viewable from all angles.

Thanks in advance.

Was it helpful?

Solution

Figured it out!

     // Because we're about to spin this triangle, be sure to draw
    // backfaces.  If we don't, the back side of the triangle is invisible.
    Appearance ap = new Appearance();
    PolygonAttributes pa = new PolygonAttributes();
    pa.setCullFace(PolygonAttributes.CULL_NONE);
    ap.setPolygonAttributes(pa);
    shape.setAppearance(ap);

Resource: http://www.duling.us/kevin/Java3D/simple/TriSpin.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top