baxxo
February 8, 2011, 11:55pm
1
Hello,
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);
t.set1(n);
t.set2(n);
t.set3(n);
results.getCollision(i).getGeometry().updateModelBound();
I correctly detect the geometry, but I cannot move the triangle. What's wrong? Can you help me please?
Thank you!
normen
February 9, 2011, 1:43am
2
The triangle is not actually part of the mesh, see the wiki entry on custom meshes about modifying meshes.
baxxo
February 9, 2011, 9:01am
3
Hello,
I red that article (https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes ) 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!
normen
February 9, 2011, 9:03am
4
Modify the buffers that the custom meshes tutorial deals with.
baxxo
February 9, 2011, 9:14am
5
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)?
[java]
Triangle t = results.getCollision(i)[/java]
I’m working on the code based on “HelloPicking” in the wiki:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_picking
nehon
February 9, 2011, 9:30am
6
I guess you’ll have to find the vertices that have the same coordinates…
baxxo
February 9, 2011, 12:48pm
7
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.
nehon
February 9, 2011, 6:03pm
8
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