No announcement yet.

Best way to synchronise a weapon and a player animation?

  • Filter
  • Time
  • Show
Clear All
new posts

    Best way to synchronise a weapon and a player animation?

    Click image for larger version

Name:	temp1.png
Views:	1
Size:	209.0 KB
ID:	1225207

    My character is set up as above.
    The weapon instance is attached as a child of the skeletal mesh, under a hand socket to automatically position the weapon in the right place.

    The character has animations set up properly using the pose caches and state machines, to correctly animate the right parts of the skeleton. This includes animations for pulling a trigger and racking the weapon's slide.
    The weapon itself also has the corresponding animations where necessary, such as for the slide and trigger movement.

    If the animations were the same length for both actors, I could probably just use a near-identical state machine setup to achieve a result, but that's far too rudimentary and restrictive, and requires changing animation length unnecessarily.

    I need to synchronise the two actors such that when the player's animation state machine triggers the player's firing animation, it also triggers the weapon's firing animation.
    So far, I have found that functions may not be called from animation states, and that attempting to use animation notifies on the beginnings of all relevant player animations to trigger the weapon's animations is nowhere near reliable.

    What's the best way to synchronise the animations of an actor and its parent actor?

    You can try to Play an Animation Montage instead of the state machine. Use the states for the normal Animation like Walking, jumping etc. Then if you want to fire or reload call Play Animation Montage. It should work. I do it so in my game.
    01010100 01101000 01100101 00100000 01110100 01110010 01110101 01110100 01101000 00100000 01101001 01110011 00100000 01101111 01110101 01110100 00100000 01110100 01101000 01100101 01110010 01100101 00101110 00100000 01010100 01110010 01110101 01110011 01110100 00100000 01101110 01101111 00110001 00100001 00100000