Download

Are bones lengths or bone tip locations tucked away in the engine somewhere?

Trying to do a box trace on the ends of limbs but can’t seem to find a way to locate the limb ends (without having to apply additional sockets). I can see the engine draws up the skeleton no problems so surely it must know of them, or knows how to calculate their positions somehow. I don’t know, hopefully someone here can help.
Thanks in advance.

Hi eanandroid,

If you take a look in FAnimationViewportClient::DrawBones you’ll see how we calculate the start and end positions for bones and render them in the Persona viewport.

Hope this helps.

Benn.

Thanks for that Benn. That’s a great help and should’ve been my first port of call when I realized the bones were being drawn up.
The DrawBones functions I have briefly skimmed through seem to be only drawing lines/cones between a bone & its parent, and now looking closer at the skeleton within persona I can see the childless-bones are not being rendered at all - I thought they were, so my apologies for wasting your time.
So really I’m back to square one; the length of the bones I am after are the ones that aren’t being rendered.
Additional sockets it is then, or a reverse line trace along the bone’s Y axis could work I suppose.

Regardless, thanks for the help.

No problem, it wasn’t a waste of time at all!

You’re correct that it’s just drawing from parent to child. I should have mentioned before that we don’t really use bone lengths so they aren’t stored anywhere. Sockets can help you get the information you’re after (as you’ve already said) or adding a tip bone to your skeleton that isn’t animated.

Hi Benn,

I’m not against sockets but to try to keep everything as portable as possible, importing & calling on a function seems more manageable for me than generating additional sockets for each skeleton. I am relatively new to this though so there’s every chance I am wrong.

Anyway, I played around with the reverse line trace back to the bone yesterday and have something that seems to work well enough for my needs now.

I create an array of floats I’ve called BoneLengths, whose indices are paired to the bone’s index. I then do a quick loop through all the bones once; those with a child I use the length between them, those without get a quick line trace.
When I need a bone’s length now I can just do a quick lookup in that table. Seems to perform quite well in testing at least, and the table isn’t populated until its needed (at present).

bdf1e16bfba90a3c82bf6b6f5a836d876a486f78.jpeg

With the lengths available I now have a pretty good box trace system where I can include bones at will:
BoxTrace1.jpg

BoxTrace2.jpg

BoxTrace3.jpg

This will work fine for me. Another hurdle overcome.

Thankyou for taking the time to help me.