How do I make a triangular prism mesh?

“insert title”
Basically, am I able to use jMonkey’s shapes to make one or do I have to make my own mesh?


Also when I tried using the dome mesh the bottom face is always invisible for some reason

1 Like

what’s your goal? to make a shape like that image?

Once again I am at work and can’t play around much … but perhaps

//the three points that make up the triangle
Vector3f p1 = new Vector3f(0,1,0);
Vector3f p2 = new Vector3f(1,1,0);
Vector3f p3 = new Vector3f(0,1,1);
Triangle t = new Triangle(p1, p2, p3);

code from → Introduction to Mathematical Functionality

Hi

Looks like some people created a prism mesh before.

2 Likes

Ali_RS, the top post answer works perfectly for me. Thank you!!

2 Likes

JMonkeyEngine supports custom meshes.

In custom meshes, invisible faces are usually caused by having an incorrect “winding order”.

In the case of a rectangular prism, there’s no need to create your own custom mesh, because the Heart library includes a class to generate prisms:

Here is how you might invoke it to create a triangular prism:

import jme3utilities.mesh.Prism;
//...
Mesh prism = new Prism(3, 1f, 1f, true);

Here is how to add Heart to your project:

4 Likes

Thanks, that is really useful. Am I able to make a right angled triangle/wedge with a preset mesh generator from jMonkey/external library?

1 Like

I don’t know of any, but I’ll take that as a suggestion for Heart v8.1 …

1 Like

Heart v8.1.0 was recently released. The Prism class includes a new constructor for prisms capped with right triangles:

4 Likes