Custom Shapes - Indices / Vertices question

Hi All,



I have somewhat of a problem creating custom shapes. Now, I define my vertices (not using any normals and a solid black colour) and then create a shape consisting of 3 triangles. As I move my camera, parts of the shape become invisible, while other parts become visible. So, for example at first 2 of the triangles are visible. Then when I move up (y axis ++ ), the 2 triangles that were just visible become invisible and the third triangle becomes visible. I’m sure this is a very simple misunderstanding on my behalf; sorry if this question sounds ridiculous :slight_smile:



e.g.



[java]vertices.add(vector0); // 0

vertices.add(vector1); // 1

vertices.add(vector2); // 2



int[] indices = {0, 5, 1, 0, 3, 1, 1, 2, 3 };



Vector3f[] verticesArray = new Vector3f[100];

verticesArray = vertices.toArray(verticesArray);

hull.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(verticesArray));

hull.setBuffer(Type.Index, 1, indices);

}; [/java]

I guess you already had a look at the mesh tutorial thread? http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/hellomesh-tutorial-jme3/



I think some similar problems surfaced there lately.



Cheers,

Normen

Yup, I did. And yup, I have already been calling updateBound() :slight_smile: …twice even:

[java]

hull.updateBound();

hull.updateCounts();



Material material = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

material.setColor(“m_Color”, ColorRGBA.Black);

hullGeometry = new Geometry(“Vessel Hull”, hull);

hullGeometry.setMaterial(material);

hullGeometry.updateModelBound();

hull.updateBound();

hull.updateCounts();[/java]

Bump? :slight_smile: