playMaker

Author Topic: [SOLVED] Unity Sword man setup  (Read 188 times)

heavygunner

  • Full Member
  • ***
  • Posts: 114
    • View Profile
[SOLVED] Unity Sword man setup
« on: September 19, 2018, 02:58:19 PM »
Hi !

It's okey when working with standard objects + playmaker.
When started to work with real objects , I don't know what to do.

I have a lowpoly character with sword on his hands. Gameplay is, character will keep running with sword. When we tap/press key, he should slash and kill enemy while running.

How to do this? I animated model for running and slashing with mixamo. But, i want him to slash while running.

« Last Edit: September 20, 2018, 01:16:21 PM by heavygunner »

Thore

  • Full Member
  • ***
  • Posts: 139
    • View Profile
Re: Unity Sword man setup
« Reply #1 on: September 19, 2018, 04:00:07 PM »
Hello,

Generally, you have to be more precise where you are stuck. :)

It seems your issue is with mecanim ("Animator" in Unity), not Playmaker. I recommend to look up documentation and tutorials for mechanim. I wasted many hours trying to figure out why the animation didn't play properly and it's usually one of the many settings that wasn’t correct. It also has many pitfalls.

In the Playmaker state when you execute the attack (after getting key down), "Set Animation Trigger" and feed in "attack" (case sensitive). That's the playmaker part regards animation.

In mechanim, add a parameter called "attack". So when Playmaker fires off "attack", the animation will go to the attacking clip.

In mechanim, connect the running state with the running attack, and set the condition to "attack" towards it. I.e. when the trigger is set off, it plays the attack clip. The transition back to running has an exit time, that’s the time from beginning to when you want to start to blend away. If you use "any state" make sure to untick the "can transition to self", which is another common pitfall.
 
As a tip, don't use keys, except you develop for certain web/PC platforms. It's generally better to use buttons, because they can be mapped in many ways for different inputs (keyboard, mouse, pads, controllers).
« Last Edit: September 19, 2018, 05:18:17 PM by Thore »