HOw to change a triangle in a mesh?


I wanted to change a triangle position inside a mesh (when the player click over the surface), so I tried this (using a collision ray):

Triangle t = results.getCollision(i).getTriangle(null);
Vector3f n = new Vector3f(0, 0, 10);

//n = n.mult(20);



I correctly detect the geometry, but I cannot move the triangle. What's wrong? Can you help me please?
Thank you!

The triangle is not actually part of the mesh, see the wiki entry on custom meshes about modifying meshes.


I red that article ( but it does not explain how to modify it, only the creation


What do you mean with

The triangle is not actually part of the mesh
? How can I modify a face of a mesh? How to modify a vertex?

Thank you for your support!

Modify the buffers that the custom meshes tutorial deals with.

Understood, thank you!

One question more: based on the fact I will use a ray to check which face I’m working on, how can I find the vertex in the buffer associated to the selected face (using ray and colliders)?


Triangle t = results.getCollision(i)[/java]

I’m working on the code based on “HelloPicking” in the wiki:

I guess you’ll have to find the vertices that have the same coordinates…

nehon said:
I guess you'll have to find the vertices that have the same coordinates...

OMG! I hope this is not the method :'(
I hope there is comething like an index to work with it.

Actually you’re right

the returned triangle as an index parameter that is the index of the triangle in the corresponding mesh.

look at the getTrangle method in the Mesh class