Getting vertex and indices from x mesh

Started by
1 comment, last by kandemor 18 years, 10 months ago
Hello, I make a collision system that works fine with static data and now I want to add support to dynamic data (animated meshes). I'm using X meshes for my animated data and I need to know the position of its vertices in each period of time. How can I do it? Thank you!
Advertisement
In animated meshs you do not need vertex positions because they are the same in every frame. List of matrices are data that represents animation, so if you need position of every vertex in some point of time just multiply vertex with animation matrix.

To get vertices just Lock/Unlock vertex buffer:

VERTEX *v;
Mesh->LockVertexBuffer(0, (void**)&v);
// do what you need
Mesh->UnlockVertexBuffer();

Ofcourse, better solution is to make copy of vertices in memory rather than using Lock/Unlock sequence.


Best,
Zaharije Pasalic

So I can do this once at loading time and recalc the transformation matrix every frame in order to calculate the exact position of each vertex, isn't it?

This topic is closed to new replies.

Advertisement