Announcement

Collapse
No announcement yet.

Runtime RootMotion Extraction

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Runtime RootMotion Extraction

    Hi Everyone, i am currently making my own movement component and i'm trying to implement Root Motion Extraction to it. I've looked at UE's Character Movement Component but i couldn't find the function responsible for the Root Motion Extraction.

    Any help is appreciated.

    #2
    Hello,

    I believe that the root motion extraction and subsequent velocity calculation is done in PerformMovement function of the CharacterMovementComponent. Extraction is taking place in TickCharacterPose function and is accumulated. Velocity is calculated after that.

    regards.

    Comment


      #3
      FVector UUBTH_BPLibrary::GetBoneLocationFromAnimSequence(const UAnimSequence * anim_sequence, const USkinnedMeshComponent * SkeletalMeshComponent, const float anim_time, const FName bone_name)
      {

      FTransform global_transform;
      global_transform.SetIdentity();

      if (IsValid(anim_sequence) && IsValid(SkeletalMeshComponent))
      {

      FName skeleton_bone_name = bone_name;

      TArray<FTrackToSkeletonMap> MyTracks;
      MyTracks = anim_sequence->GetRawTrackToSkeletonMapTable();

      do
      {
      const int bone_index = SkeletalMeshComponent->GetBoneIndex(skeleton_bone_name);
      FTransform bone_transform;
      int track_index = 0;


      for (track_index = 0; track_index < MyTracks.Num(); ++track_index)
      {
      if (MyTracks[track_index].BoneTreeIndex == bone_index)
      {
      break;
      }
      }



      if (track_index == MyTracks.Num())
      {
      break;
      }

      anim_sequence->GetBoneTransform(bone_transform, track_index, anim_time, false);
      global_transform *= bone_transform;

      skeleton_bone_name = SkeletalMeshComponent->GetParentBone(skeleton_bone_name);

      } while (skeleton_bone_name != NAME_None);
      }
      else
      {
      GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("GetBoneLocationFromAnimSequence->SkelMesh or Anim Seq not valid!")));
      }

      return global_transform.GetTranslation();
      }

      HUD links | Crane Balk | Point Clouds Morphing | Rain Drops | Manipulator Robot | Welder Robot | Mini Games | Masked Blur | Voxel Cars

      Comment

      Working...
      X