View Full Version : Help (easy) with assigning verticies to a bone

Bossa Nova
08-23-2002, 11:35 AM
I'm trying to implement bone based animation for a model format I'm working on. Essentially I simply represent each bone by a Quaternion that I plan on multiplying by its assigned verticies. Problem is, I'm new to tools writing and I can't figure out any way to select verticies.

Ideally, the artists on the project would like to be able to click and drag around the verticies they would like to assign a bone to and then assign it.

I think I need to render to the Feedback buffer but I'm not entirely sure how to and can't seem to find any good tutorials on how this would be done. Can someone please help me?

BTW, this is my first post here.

08-23-2002, 01:40 PM
Is this like a 3D-Editor? If I understand your question correctly...

For 2D view windows (front, side, top), you can simply find the distance from the selection (cursor/mouse) point to the vertex. You will write a loop that goes through all visible (or selectable) vertices and only selects the vertex with the shortest distance.

There are tricks you can use to speed up the above algorithm (as well as following).

3D vertex selection can be done the same why as far as I know (AFAIK). You will have to know how the final vertices will be projected to the 2D screen so you can use your 2D selection (cursor/mouse) point.

If you have a 3D selection (cursor/mouse) point then you can simply use the closest vertex by finding the distance between the 3D selection and 3D vertex point.

"There is more then one way to skin a cat", the methods above are just the ways in which I would do them.

I am not very experienced in OpenGL, so these may not be the ideal solutions.

"If it looks right, it is right"

*----- Appended -----*
A good way to learn how to solve problems like this is to ask your self how "you" would do it. Draw a few points on a piece of paper and use your pencil as the cursor. How would you (or the artist) pick the desired vertex?

[This message has been edited by hkyProgrammer88 (edited 08-23-2002).]

08-24-2002, 09:05 AM
Try opengl selection as described in the programming guide, or in the nehe tutor. Drawing little quads in selection mode for each vertex, then you can get info for each pixel on the screen witch quads are there.

p.s: sorry for my poor english