Sign in to follow this  

Getting vertex and indices from x mesh

This topic is 4560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

This topic is 4560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this