Problem with animation system being in the past

Hi,

I seem to have a problem where the animation system is in the past, in relation to other systems, in this case, an actor component.
From an actor component I update other actors location in the world, then in my custom AnimInstance I read those locations and place the hands on those actors.
I think the main problem is that I want to achieve two things, depending on the current game play state:

  • Items are placed in world and hands attach to them
  • Hands (Animation) drive the items (Items are placed where the hands are)

On this first video, one can see that when I move the items from within the InventoryComponent, they are correctly placed in the hands (animation), so I think it is safe to say that when the InventoryComponent Tick function is called, it knows about the present location of the hands.

Video 1 - Items moved to where hands are, and this is expected behavior

On this second video one can see that when animation is updated, it reads old values from the actors

Video 2 - Hands are moved to where items are, not expected behavior since hands lag behind, seems to be in the past

Sorry about the flashing videos, unsure why that is happening with UE4 editor.

EDIT:
After some more investigation I think I have found the issue. What happens is the following:

  1. Animation system is updated
  2. Items are updated

The issue is that I have created a circular dependency between the two updates.

  • Animation depends on the items so it knows where to place the hands
  • Items need to know about animation system socket locations, because they are placed relative to a certain mesh bone

I was expecting to happen the following (which doesn’t make sense):

  1. Animation system is updated
  2. Items are updated (Depend on animation to be updated, because items are moved in relation to certain bones in the mesh)
  3. Animation system updates hands to follow items

So what I’m trying is simply wrong, any ideas how to approach such a situation?
Any help is appreciated,
Thank you.