0
\$\begingroup\$

I have a movement system for my characters where the model is allowed to lag behind the character's actual position. In a way it is like the model is being dragged on a string behind the actual position. This works well to smooth out the movement when the character is running around corners or changing direction, because the pathfinder will supply a list of waypoints that are otherwise followed in a straight line.

The only problem I have is when the character is interrupted in his movement, if for instance he spots an enemy and wants to shoot at him. In this case the rendered model will often be a bit behind the actual position.

What is currently happening is that the character changes state to shoot, but this is not immediately reflected in the model, because it is still moving (lerping) towards the actual position. As a result, when the model finally gets there, it will not have time to play the full shoot animation, so it appears like the character just lifts his weapon halfway to aim, then lowers it again.

What is the best way to resolve this issue? It seems like there is no perfect solution...

\$\endgroup\$
  • 1
    \$\begingroup\$ It seems that if 'the character is interrupted in its movement', then lerping should stop where it is, no ?? After the shooting is done, re-launch another lerp to target point. \$\endgroup\$ – GameAlchemist Aug 7 '14 at 15:35
  • \$\begingroup\$ Hmm. This approach would mean that I have to make lerping dependent on the state of the character. So if the character is idling, then lerping is OK, but not if he is attacking... \$\endgroup\$ – Rye bread Aug 7 '14 at 17:13
  • \$\begingroup\$ no, you can have, for instance, a 'pauseLerp' and a 'resumeLerp' function that allows you not to change all your logic. \$\endgroup\$ – GameAlchemist Aug 7 '14 at 17:16
  • \$\begingroup\$ I think I can use this idea, but all my animation is data driven, so it has to fit in somehow. \$\endgroup\$ – Rye bread Aug 7 '14 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.