I made some changes to the particle monkey code to get the desired effect
I read most of the particle monkey code to get a rudimentary understanding of particle monkey.
I made the following modifications to Particle Monkey to make Particle monkey more suitable for me.
/**
* Set the current particle emission face to the specified faces index
* @param triangleIndex The index of the face to set as the particle emission point
*/
public void setNext(int triangleIndex) {
Mesh m = mesh.getMesh();
// Transform transform = emitFromWorldSpace ? mesh.getWorldTransform()
// : mesh.getLocalTransform();
// m.getTriangle(triangleIndex, p1, p2, p3);
// transform.transformVector(p1, triStore.get1());
// transform.transformVector(p2, triStore.get2());
// transform.transformVector(p3, triStore.get3());
// triStore.calculateCenter();
// triStore.calculateNormal();
if(emitFromWorldSpace){
//mesh.setIgnoreTransform(false);
Transform transform = mesh.getWorldTransform();
m.getTriangle(triangleIndex, p1, p2, p3);
transform.transformVector(p1, triStore.get1());
transform.transformVector(p2, triStore.get2());
transform.transformVector(p3, triStore.get3());
}else if(!emitFromWorldSpace){
// mesh.setIgnoreTransform(true);
Transform transform = mesh.getWorldTransform();//mesh.getLocalTransform();
transform.setRotation(mesh.getLocalTransform().getRotation());
transform.setTranslation(mesh.getLocalTransform().getTranslation());
m.getTriangle(triangleIndex, p1, p2, p3);
transform.transformVector(p1, triStore.get1());
transform.transformVector(p2, triStore.get2());
transform.transformVector(p3, triStore.get3());
}
triStore.calculateCenter();
triStore.calculateNormal();
}
I found that the particle’s Transform completely follows the EmitterMesh.
My EmitterMesh is a model.
The model was loaded in a node which caused the particle generation to be somewhat different from what was expected.
Can I submit my changes to Particle Monkey?
What do I do to get the EmitterMesh’s Transform to appear in the right place if I can’t commit a change?
(If you have any questions about my questions, please point them out)
(I hope the administrator can help me classify correctly. Thank you very much)
Thanks to yaRnMcDonuts for their help