View Full Version : Get length of a Biped bone?

Rick Stirling
07 July 2008, 03:02 PM
I can't figure out how to get the length of a Biped bone.

For a normal bone it's simple - $.length.

Perhaps I need to think about it in a different way: I want to know the length so that I can calculate the start and end points of it (along the local X axis). For the thigh it's easy, I measure between the thighbone pivot and the calfbone pivot, but on the Char Hand I don't have a child to query.

07 July 2008, 10:01 AM
you could do it by popping the character into figure mode and getting positions of bones.

for example to get the lenbth of the upper arm you can get the position of the upper arm and the elbow. then all you need to do is return the length. I think there is a function called length() that does this

alternatively you could save the biped out as a .fig file and read that. it seems to store a bunch of matrices in there You might need to read up on that though

I am guessing your biped doesnt have any finger bones. It should still make a dummy called bipedname_nub. use its pivot point to get the length of the hand of course you can return a base name bye queriring any biped bone you cuold alsof define a naming convention for bipes that you could use something like filterstring on to return the basename

07 July 2008, 10:18 AM
A cheat to get the length of the wrist bone would be to temporarily change the number of fingers to 1, in the figure mode Then you could easily find the distance between the wrist bone and wrist.children[1]
Ofcourse, you'll need to take care that you dont ruin the skin

Rick Stirling
07 July 2008, 10:26 AM
Cheers folks!

I do have finger bones, but the fingers are quite offset. I wanted to place a marker in the exact centre of the biped bone, which is why I wanted the position of the exit point of the X axis (posa - posb = central points)

Due to Biped being 'difficult' to query, I'm considering duplicating the figure mode and converting the clone to Epoly objects.

I could set the clone to have one finger, and that'd get a good position. It still all seems a little 'hacky' though.

07 July 2008, 03:12 PM
Hi Rick!

Did i understand correctly - You need the center of biped bone?

If so, you don't need biped specific info. Just use $.center, which will give you the center of any node.

If you want to calculate length of biped bones, get the position of bone with $.transform.pos (if i remember correctly, biped doesn't give pos with $.pos...) then get a child bones position, and calculate length. But you might have multiple children.

Hope this helps.

Rick Stirling
07 July 2008, 03:38 PM
/slaps head

Doh! Such an obvious solution, cheers!

(yes, for the hand I have multiple children, for the other limbs I was using the pivot point plus the childs pivot point. I was then using a findinbetween function to pass in 25%, 33% etc. to find various points along the bone.)

Ah, with $.center I can also extrapolate that to find the endpoint if I need to! Thanks again!

CGTalk Moderation
07 July 2008, 03:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.