Any way to switch mesh instances when an action is performed?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ProjectROR

Hi, so, I am making a game, and I want it to look like it was made in the early 2000s, so I am using separate models for certain actions. Like a string of code that lets me switch mesh instances multiple times on a loop, and when I let go of directional keys, it goes back to idle. Or, when the character touches the ground after jumping, it goes back to idle. (eg. If I press W, A, S, or D, it switches to walk1, idle, walk2, idle or when I press space it goes to jump1, jump2 etc.) Is there a script that allows me to do this? I’m not very good at coding but still want to make this simple game. Thanks for reading!

Have you tried looking into animation states? You can have animations “flow” into one another. For instance, when the player presses a certain key, the character starts their walking animation. When the player releases the key, the character changes to their idle animation. Have each of the animations in an array, detect the current animation, and change to the appropriate animation.

Hope this helps.

Ertain | 2019-11-25 00:50