- Home /
Lerpz Tutorial Run and Punch effect together
Ok in the finished Lerpz tutorial he can punch but it only has the effect it should do if he's standing still, if you were to punch while moving the punch would have no effect, but if you stop moving and then punch it works perfectly every time.
How would I go about getting the punch to work regardless of other movement?
Answer by Luzhien · May 11, 2011 at 11:22 AM
Hi, I'm having the same problem but I can't figure the solution. Can you explain it please?
Please, if you don't have an answer and want to add something, add a comment using the "Add Comment" button. Otherwise other people will think this question was already answered.
Answer by Cyb3rManiak · May 11, 2011 at 12:14 PM
What happens is that run animation is a whole animation, with keyframes for Lerpz's entire body, and so is the punch animation.
The two animations are on different layers.
From the Unity's scripting reference:
When calculating the final blend weights, animations in higher layers will get their weights distributed first. Lower layer animations only receive blend weights if the higher layers didn't use up all blend weights.
Even if you play the punch animation, the run animation is on a layer that gets priority.
I would imagine you will either need to move the punch animation to the layer of the run animation (which is not advisable), move it to a layer which will have priority over the layer of "run" (a higher layer than the layer of run) or call the punch animation using Animation.Crossfade using PlayMode.StopAll for the second parameter (playmode, which default is PlayMode.StopSameLayer).
Your answer
Follow this Question
Related Questions
Can't find how Lerpz punches Copper 2 Answers
Lerpz ThirdPersonPlayerAnimation bug - running at walking speed 1 Answer
Effect when player is running? 1 Answer
city windows 1 Answer
Particle effect spawn help 1 Answer