Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Animation : Find time of global min/max position of a given bone


given a bone and an animation I'd like to get the time when that bone is at it's highest/ lowest position. ( and then create notifys at those times )

I've searched through UAnimSequence and its parents. My idea would be to use

     const struct FRawAnimSequenceTrack & InRawAnimationTrack,
     FTransform & OutAtom,
     float Time)

and interate through the length of the animation to get an array of transforms over the whole animation. But I doubt this will be enough to find the max/min position since the bone is affected by its parents in the hierarchy. So even if I found a min/max position this would be a local min/max and not a global one, right ?

Does anyone know an easier way to do this?

Product Version: UE 4.17
more ▼

asked May 19 '18 at 06:11 PM in C++ Programming

avatar image

22 4 6 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I solved it with the following code, please correct me if something is wrong

 int GetFrameOfLowestPosition(UAnimSequence * anim, FName BoneName)
     FName ParentBone;
     FTransform Pose;
     FTransform ParentPose;
     TArray<FTransform> Transforms;
     const int32  NumFrames = anim->GetNumberOfFrames();
     for (int i = 0; i < NumFrames; ++i) {
         ParentBone =  PlayerMesh->GetParentBone(BoneName);
         UAnimationBlueprintLibrary::GetBonePoseForFrame(anim, BoneName, i, false, Pose);
         while (ParentBone != "None") {
             UAnimationBlueprintLibrary::GetBonePoseForFrame(anim, ParentBone, i, false, ParentPose);
             Pose = Pose * ParentPose;
             ParentBone = PlayerMesh->GetParentBone(ParentBone);
     float Minimum = MAX_flt;
     int key = 0;
     for (int j = 0; j < Transforms.Num(); ++j) {
         if (Transforms[j].GetLocation().Z <= Minimum) {
             Minimum = Transforms[j].GetLocation().Z;
             key = j;
     return key;
more ▼

answered Jun 09 '18 at 09:51 AM

avatar image

22 4 6 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question