Hi!
I would like to try add(attach) some primitives (like spheres as eyes) to animated mesh. So I decide to get one verticle from mesh and use its coords and normal to attach some primitives.
there is my code, but there is one problem: the animation stoped to work(like set on pause or smth like that)...
In main update cycle:
Maybe there is some other way to handle it?
I would like to try add(attach) some primitives (like spheres as eyes) to animated mesh. So I decide to get one verticle from mesh and use its coords and normal to attach some primitives.
there is my code, but there is one problem: the animation stoped to work(like set on pause or smth like that)...
Code Select
public class Player extends Object3D{
public Player(Context AppContext, World world, Resources res) {
// loading and setting stuff...
vc = new VertexController(20);
this.getMesh().setVertexController(vc, true);
this.getMesh().applyVertexController();
world.addObject(this);
}
/* VERTEX CONTROLLER */
private static class VertexController extends GenericVertexController {
private int vertexID;
VertexController(int pVertexID) {
this.vertexID = pVertexID;
}
@Override
public void apply() {
SimpleVector[] srcMesh = this.getSourceMesh();
int size = this.getMeshSize();
if(vertexID < size){
mVertexX = srcMesh[vertexID].x;
mVertexY = srcMesh[vertexID].y;
mVertexZ = srcMesh[vertexID].z;
}
}
}
In main update cycle:
Code Select
public void onDrawFrame(GL10 gl) {
// player animation code
player.getMesh().applyVertexController();
player.touch();
}
Maybe there is some other way to handle it?