Ray Picking animated mesh

Started by
3 comments, last by Starnick 11 years, 8 months ago
Hi everyone.

I am currently working on ray picking stuffs and I am happy and successfully done ray picking with static mesh.

But now, I found that my ray picking code, which is commonly posted on the internet and in the DirectX sdk demo (the D3DXIntersect()), cannot work in animated mesh, like characters.

So, what should I change the code so that I can pick the animated mesh accurately?

Thanks all guys!
Advertisement
The transformed mesh is only temporarily created during the vertex shader, not in your game logic code where you do the picking. You will have to create the transformed mesh in your code to be able to pick it, but depending on the complexity of your animation and the amount of animated objects in your scene, this can use up a lot of processing power. If you got multiple objects (e.g. units on a battlefield) I would first do a picking via a normal hitbox, and then check for intersection with the detailed animated mesh.
Thanks!
If you got multiple objects (e.g. units on a battlefield) I would first do a picking via a normal hitbox, and then check for intersection with the detailed animated mesh.

You should even consider whether you need the second step, maybe a hitbox picking is enough? This of course depends solely on what you are doing and what you want/need to achieve.
If you need finer picking, for that second step, one idea would be to create a "collision mesh" (e.g. take a look at Valve's Source SDK) that is a simplified version of the animated model. Another possibility would be representing the model as a series of smaller hitboxes, e.g. one that moves with the head bone, another that moves with the torso bone, several that represent the arms/legs, etc.

This topic is closed to new replies.

Advertisement