No announcement yet.

Bone location in an UAnimSequence

  • Filter
  • Time
  • Show
Clear All
new posts

    Bone location in an UAnimSequence


    I am currently trying to implement a system for a ragdoll to stand up after falling. Standing up will be done using animations. My current idea is to take bone transforms of the ragdoll relative to the root bone when it's lying on the ground and compare them (using cosine similarity) with bone locations of the first frame of every animation I have for standing up. Having the similarity calculated I would pick the animation with the highest similarity.

    My problem is that I don't really know how to extract bone transforms from an UAnimSequence. There is a void GetBoneTransform(FTransform& OutAtom, int32 TrackIndex, float Time, bool bUseRawData) const method, but how does the TrackIndex correlate to a bone in the skeletal mesh and also the Transform is always relative to the parent, but I don't know what is the parent's track index. As far as I understand a track index is just like a bone index only for animations, right?

    To me this seems that in order to calculate the the locations I would need to calculate myself the transform of a track index relative to the root bone, but I don't know how to traverse the track hierarchy up to the root knowing just the track index.

    Hopefully somebody can clear this up a bit. I will appreciate any kind of help

    Thanks in advance!