Topic: Moving character forward during an attack?

I have an attack move where character moves forward and swings his sword from side to side. What would be the best practise to move character forward during this move (before the hit connects)? Is the self aplied forces the only way to do this? I can get it to work using it but there is still noticeable feet slipping.

Share

Thumbs up Thumbs down

Re: Moving character forward during an attack?

If the animation has root motion applied (i.e. it moves forward as part of the animation), you can use that.  Just need to check the Apply Root Motion.  See this thread for more info on Root Motion.

You can avoid some slipping by using Applied Forces to stop movement as well (set it to zero and check Reset Applied Forces).  I usually scrub through an animation to see which frame a foot is planted and zero the movement there.

Share

Thumbs up Thumbs down

Re: Moving character forward during an attack?

Ok, I'm having major problems getting this to work right. I noticed that Unity 5 has option in the animation import menu for root motion node also. Has somebody got root motion working in Unity 5? I need to run more tests, but I feel that I got pretty good grasp of the Unity, UFE and Blender so there might be a potential problem with Unity 5 and UFE here. I investigate and post my findings later.

Share

Thumbs up Thumbs down

Re: Moving character forward during an attack?

This is the part where I get confused. Which settings shoud I use for the root motion node? I tried to set it to a root bone I have for my character but it wont work as expected.
https://dl.dropboxusercontent.com/u/2988574/WhichSetting.png

Share

Thumbs up Thumbs down

5 (edited by vvaris 2015-03-19 10:50:50)

Re: Moving character forward during an attack?

Ok, back to the basics.. I went over every possible combination I could think off in Blender, UFE and Unity. Tried to look for an example move that would use this feature in the excample project, found none. Has anybody at any time managed to use the "apply root motion"? I would like to see excample file on how this should play out. I would really like to get this working.

Share

Thumbs up Thumbs down

6 (edited by vvaris 2015-03-19 12:54:47)

Re: Moving character forward during an attack?

Progress!
I checked my character in runtime and looked at the animator component. "Apply root motion" was off, turned it on and the animation works. I checked the MoveSetScript and line 237 was commented out, "//animator.applyRootMotion = true;" Not sure if this is how it was when we got UFE, or did we comment it out.

Share

Thumbs up Thumbs down

7 (edited by vvaris 2015-03-19 12:46:36)

Re: Moving character forward during an attack?

I still have a problem the character returning to starting position after the animation. Instead of staying at the end position.
I get error "transform.position assign attempt for 'Base 1(Clone)' is not valid. Input position is { NaN, NaN, NaN }."

Share

Thumbs up Thumbs down

Re: Moving character forward during an attack?

vvaris wrote:

I still have a problem the character returning to starting position after the animation. Instead of staying at the end position.
I get error "transform.position assign attempt for 'Base 1(Clone)' is not valid. Input position is { NaN, NaN, NaN }."

That error is usually because an imported animation clip has the wrong import settings, or you're missing an animation clip (usually one of the basic ones - you should find the error only happens during specific situations, like when you're hit).

vvaris wrote:

I checked the MoveSetScript and line 237 was commented out, "//animator.applyRootMotion = true;" Not sure if this is how it was when we got UFE, or did we comment it out.

I believe that line is commented out deliberately.  It's not at 237 on my file though.

The Apply Root Motion in UFE doesn't use the Apply Root Motion in the Animator component, instead it forces the character to be at the position the root node is in (or character transform).

However, if this is working for you, then by all means keep it uncommented wink.

BTW, UFE isn't supported in Unity 5 yet...

Share

Thumbs up Thumbs down

9 (edited by vvaris 2015-03-20 07:08:07)

Re: Moving character forward during an attack?

YumChaGames wrote:

The Apply Root Motion in UFE doesn't use the Apply Root Motion in the Animator component, instead it forces the character to be at the position the root node is in (or character transform).

However, if this is working for you, then by all means keep it uncommented wink.

BTW, UFE isn't supported in Unity 5 yet...

Unity 5 seems to be working ok for me, except for the animation preview that is a known issue.

So if UFE forces the character to be in the root node, maybe "douple root bone setup" might work then..

Share

Thumbs up Thumbs down

Re: Moving character forward during an attack?

I don't undertand why my character doesn't move back to idle animation after move that has "apply root motion"?

Share

Thumbs up Thumbs down

Re: Moving character forward during an attack?

Tried the double rootbone setup but no use, mechanim human just doesn't work like that I gues: http://forum.unity3d.com/threads/2-root … ic.312449/

Share

Thumbs up Thumbs down