Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: MP on November 17, 2012, 12:49:20 AM
-
What's the best way to link an animation (say, a walk cycle) to an object's movement. I want the animation to play only while the object's transform is moving. I want a different animation to play once the object is no longer moving.
I'm sure this is covered somewhere, and I'm just not finding it. Thanks.
-
I managed to get this working very simply.
In my game the character moves left and right with A and D, all i did was set it up so that when one of these keys were pushed the appropriate animation would play. So when you push a key, movement and the animation work at the same time from the same key.
I hope this makes some sense to you, if not i can post up some pictures
-
Ah, yes. I understand well how to check if the player's character is moving. I mean a non-user controlled character, for example, an enemy AI.
While the enemy AI is advancing toward the player, his walking animation should play. When he reaches a certain point and stops, his walking animation should also stop and transition to a standing pose.
I should have worded the Subject line of my question more clearly. Thanks, though, for your reply.
-
Ahh ok, the only thing i can think of is putting a Play Animation action in the same state as the movement action but it depends on how things are set up, how are you moving the enemy?
-
Two ways: some of the enemy AI's are moved along an iTween path. The others I'm moving via FSM MoveToward, setting the player as the target.
I could have the animation play in the same state as the MoveToward, but what happens if the player quits moving and the enemy AI arrives at the player's location (plus the programmed offset)? In that case, the enemy AI is still playing the walk animation, for example, even as he doesn't go anywhere. That looks strange, doesn't it?
-
If you could post up some pictures of your setup or make it into a package and i'll see what i can figure out as i'm not understanding your setup.
-
What I did, whether the character is moved by user input or AI, is this: In the state you're moving, you do the translate (whichever way you prefer), and send an event to another FSM which controls the animations for the current character. This approach might require 2 FSMs in a character, but your movement is less coupled to the animation.