#Animator layers

1 messages · Page 1 of 1 (latest)

viscid lichen
#

Okay, that's reasonable. How are your animator layers arranged?

thorny forge
#

also, I figured out a way which it'd work

#

I can use Additive blending

#

and it works almost fine

#

but combined with the walking animation, some jank starts to happen

#

lemme get a vid

viscid lichen
#

i've gotten some really wacky problems from additive blending

thorny forge
#

my main idea would be to essentially create an attack animation that doesn't have the legs involved, so the blending wont mess it up

#

I'm almost willing to leave it like that for the time being

#

the problem is that the character wasn't made as a "Humanoid" from the beginning

#

I converted it to humanoid, but with quite a few issues

#

I also haven't applied the transforms in Blender for the character, and the whole character and rig gets fucked up if I do

#

so im probably gonna have to do that again

viscid lichen
#

Ah, yes, avatar masks have two separate modes

#

The one you showed was for humanoid avatars

#

The other is just a list of every transform in the avatar, which lets you set it up for generic avatars

#

Since this is humanoid, I would suggest creating a new humanoid avatar. You'll need to make sure the animations are imported using the new avatar.

#

Then your avatar masks will work as expected.

thorny forge
#

also @viscid lichen fun fact I figured out yesterday's issue with the fucked up patterns

#

the reason was because of the enemy's rotation

#

it usually happened when you dashed very close to it

thorny forge
#

im exporting fbx files for the animations from blender

viscid lichen
#

Just change the avatar they’re using in the import settings

#

You can copy it from the player model’s avatar

thorny forge
#

oh wait

#

lemme test

#

also, can I just copy out the animations from the fbx?

viscid lichen
#

I used to duplicate them, but I don't do that anymore

#

If you update the FBX, and you're using the animation sub-assets of the FBX asset, then you don't have to do anything

thorny forge
#

sorry, im confused

viscid lichen
#

if you duplicate the animations out of the FBX, then you'd have to delete the old ones, duplicate them out again, and re-assign everything

thorny forge
#

thats essentially what im doing rn

#

the problem is if I don't copy out the animations from the fbx, I can't put Events in the animations

#

because they're ReadOnly

viscid lichen
#

ah, you just need to do to in the import settings for the asset

#

you also get a nicer interface, IMO

#

These sub-assets are generated based on the import settings for the FBX asset.

#

this is something i took a hot minute to figure out

#

You can create many animation assets from one or more source takes from the asset

#

In this case, I glued four different mocap sessions into one animation, then used that to generate six animation assets

#

(two are mirrored with a cycle offset)

thorny forge
#

i am justs confused dude

#

im sorry

viscid lichen
#

from the top

#

you exported an FBX

#

Unity sees this file and imports it as an asset.

#

It knows how to parse an FBX file, so it doesn't just show up as a generic file asset.

#

When you click on the asset in the Project window, the inspector displays an Import Settings dialog

#

You use this to tell Unity how to import the FBX file.

#

Notably, this is where you tell it which avatar to use (in the Rig section)

#

and in the "Animation" section, you can see all of the animations it's going to import

#

By default, each take will become its own animation.

#

each Blender action becomes a take, for example

#

When you hit Apply, Unity reimports the FBX asset.

#

This results in a number of sub-assets

#

In this case, it produced six animation assets and a prefab asset.

thorny forge
#

well

#

i have like 30 animations

#

half of them are duplicates

viscid lichen
#

30 animations in this list, or 30 animations just lying around your Project window?

#

(remember, this is the "Animation" tab in the import settings for the FBX asset itself)

thorny forge
#

yeah

#

hold on

#

i have this rn

viscid lichen
#

Okay, that looks solid

thorny forge
#

what if I want to add an event to an animation

viscid lichen
#

Scroll down a bit

thorny forge
#

it just says ReadOnly

viscid lichen
#

There's an "Events" tab

#

Again, you aren't trying to edit the sub-assets

thorny forge
#

what about the animator btw

#

I will essentially have to recreate it no?

viscid lichen
#

You'll need to drag the new animation assets in

#

(or select them from the list)

#

but once you've done that, you should never have to assign them again

#

unless you completely change the names of your Blender actions

#

also, pro tip: check out the Quick Exporter blender add-on

#

it saves the FBX settings for you

#

so you just hit a button and boom

#

I try to automate as much as possible, since I will completely forget my export settings

#

(this is more vital in Unreal, which is really damn sensitive to how you export the FBX)

thorny forge
#

how can I set this to calculate in frames not in seconds

#

because i have no fucking clue on which pixel that things needs to be on

thorny forge
viscid lichen
#

note that the event tick actually shows up a bit before its time...

#

This is an annoying behavior.

thorny forge
#

is 0:00 to 1:00 relative to the animation length?

viscid lichen
#

I use Animancer for all of my animations now (instead of animation controllers). It lets you exactly set the normalized time / absolute time / frame number

#

a lot more convenient

viscid lichen
thorny forge
#

stupid but whatever

#

it works

thorny forge
viscid lichen
#

oh yeah, it's a huge leap

#

it's entirely code-driven animation

#

it's also a paid package

thorny forge
#

guessed that much

#

i dont want to pay any money for gamedev yet

#

if I can do it free, ill just do it free for now

#

not like i have a deadline to hit

#

yeah ngl this is much cleaner

#

thank you again

viscid lichen
#

I only started buying packages a fair ways into my time with gamedev

thorny forge
#

great. what do I do now @viscid lichen

#

it merged my shield bone together with my forearm bone

#

wont let me create the rig

#

it also just bonked all my animations

viscid lichen
#

It's trying to use the shield bone as part of the humanoid avatar?

thorny forge
viscid lichen
#

You can fix that in the avatar configuration

thorny forge
#

and it merged the shield bone together with the forearm

viscid lichen
#

Did you export a separate FBX that's just the model?

#

Or is everything coming from one FBX?

thorny forge
#

one fbx

#

because it wouldnt work otherwise

viscid lichen
#

actually, the first thing I'd do is to change the name of the bones in Blender so that they can be ID'd correctly

thorny forge
#

how can I fix it

viscid lichen
#

what did you name these bones?

thorny forge
#

the forearm is called LowerArmL

#

and the shield bone is just called Bone

#

doesnt explain why tf it merged them though

viscid lichen
#

select the FBX asset, then hit "Configure" in the Rig menu

#

examine this list

thorny forge
thorny forge
viscid lichen
#

What do you see in that list?

thorny forge
#

i had to change some of them manually cuz itd give errors

#

but there is no transform for the sword

#

idk how to go about it

#

hold on

#

i think i did it

viscid lichen
#

The sword would not show up in here. This is just humanoid body bones.

thorny forge
#

okay so

#

now there are no animations.

viscid lichen
#

have you successfully created the avatar from the FBX asset?

thorny forge
#

yes

viscid lichen
#

do the animations preview correctly in the Import Settings dialog?

thorny forge
#

I got a checkmark

#

oh

#

they dont.

viscid lichen
#

oh man this shader is broken

thorny forge
#

like, not all of them

#

wait

#

they do

viscid lichen
#

okay, so you should be able to update your Animator Controller

#

delete your old duplicated animation assets

thorny forge
#

I did already

#

I did all of that already

#

updated the animator controller etc

viscid lichen
#

assigning the new animation clips to each animator state?

thorny forge
#

oh shit hold on i messed smth up

viscid lichen
#

hang on i have two cats screaming at me

thorny forge
#

somethings real fucked up

#

there are some animations

#

but they seem to amalgamate with others

viscid lichen
#

okay, so now for an important bit

#

you've got a player model in the scene right now

#

where is that coming from?

thorny forge
#

from the imported fbx

#

I changed that too

viscid lichen
#

okay, good

thorny forge
#

I can show, its VERY jank

#

i did fuck up a dashing direction imma fix that

viscid lichen
#

I wonder if you are now seeing the AvatarMasks kicking in

#

and causing weird problems because you had it on Additive

thorny forge
#

they arent on additive

viscid lichen
#

until now, you were using a Generic avatar, so those AvatarMasks did nothing

thorny forge
viscid lichen
#

Set the weights on the body layers to zero so that we just see FullBody

#

see how it behaves then

thorny forge
#

well

#

it kinda doesnt behave

#

even the dashing is incapable of playing

#

...if i dont have all 3 of them on max weight, i cant dash?

#

it looks as if it was still additive

viscid lichen
#

I'd drag out a new copy of the player model (just drag the entire FBX asset into the scene) and manually mess with its animator

#

see if it's animating correctly

viscid lichen
#

in what context?

thorny forge
#

as in test it

viscid lichen
thorny forge
viscid lichen
#

then enter play mode with the object selected

#

you can then go to the Animator window and see the animator in-action

viscid lichen
#

You might still want the animations to run if they need to trigger events

#

"Cull Update Transforms" will stop it from changing the transforms, but should still trigger events

thorny forge
#

it feels like the avatar masks dont even affect it

viscid lichen
#

pick one of the animator states and click on its Animation Clip

#

make sure this takes you to where you expect (a sub-asset of the model asset)

thorny forge
#

the animations are perfectly fine

#

for some reason it tries to blend them together

viscid lichen
#

If this was referencing an older animation asset, then that could cause very bizarre behavior

thorny forge
#

like as if it tried to blend the idle animation together with a walking animation

viscid lichen
#

How do you switch between idle animations and walking animations?

thorny forge
viscid lichen
#

no, in the animator

#

is it a blend tree? different states entirely?

thorny forge
#

yeah

#

there is no problem with the blend tree either

#

it switches between animations as it should

viscid lichen
#

What are the other two layers doing? Are they sitting in states with no animations in them?

thorny forge
#

thats the main problem i believe

#

idk how to do that

viscid lichen
#

They're going to clobber both the upper body and the lower body

thorny forge
#

yeah

viscid lichen
#

Add a state with no animation clip and turn off "Write Defaults", I believe

thorny forge
#

but how can I make it not then

viscid lichen
#

Write Defaults makes the animator state write a default value to every single channel that's animated by anything on the same layer, iirc

thorny forge
#

i have that in the other ones

#

i figred that out

thorny forge
#

do i just need to create an edge case for every action

#

like "if the player is attacking or if the player is moving or if the.... then enter this empty state?

viscid lichen
#

You just want the upper and lower body layers to do nothing if there's no particular animation to play

thorny forge
#

no

#

I don't want the idle animation to play while I am attacking

#

I have a specific idle animation

#

and I want that to turn off during any event

viscid lichen
#

Right. The UpperBody and LowerBody layers will override whatever the base layer is doing.

thorny forge
#

appareantly not

viscid lichen
#

Which layer is walking handled on?

thorny forge
#

LowerBody

#

should I handle walking on the base layer

viscid lichen
#

I prefer to do that there, yes.

#

Other things should override the walk movement

#

(also, if you don't allow it to move the torso, you'll get weird looking walking)

#

to sanity check it, remove the mask and see how the animation looks

thorny forge
#

man

#

even more broken

thorny forge
viscid lichen
#

Make a new animator controller. Put just a single state in it that plays a single clip

#

I'm unclear where your problem is, but we might as well make sure that is behaving

thorny forge
#

excuse me what the actual fuck

#

hold on

#

something is fucking with it still

#

now the upperbody animation looks perfectly fine

#

everything works fine except the legs

viscid lichen
#

again, make a new animator controller to make sure a single animation is playing correctly

thorny forge
#

my entire rig is just fucked

viscid lichen
#

i don't know what exactly your animator controller does

thorny forge
#

the problem isnt with the controller

viscid lichen
#

so I'm trying to guess

#

have you verified that by doing what i've suggested?

#

play one animation clip by itself with nothing else going on.

thorny forge
#

it's pretty obvious

#

for some reason it thinks that the hip is the neck

viscid lichen
#

just humor me please

thorny forge
#

the problem is that the entire rigging system is fucked

#

the spine must be a child of the hips

viscid lichen
#

sounds like you should reassign the transforms, then

thorny forge
#

if it'd let me do it properly....

thorny forge
#

like the lowerspine should be the parent of the upperspine

viscid lichen
#

yes, the chain should be hips -> spine -> chest

thorny forge
#

"did it reverse during rigging? fuck you then"

viscid lichen
#

is your root bone not the hip?

thorny forge
#

no

viscid lichen
#

okay, that makes things more understandable

#

it wouldn't be that hard to rearrange the bone hierarchy so that the hips are the root

#

If you don't want to, though, then you can't make this a Humanoid avatar, and you'll need to make it Generic instead. That's not going to be a huge problem if all of the animations are made for this exact model.

thorny forge
#

except the hips are 2 bones.

#

dude

#

at this point it'd literally be easier to re-model a character

#

re-rig it

#

re-animate all 15 animations

#

and just fuck this entire thing

#

because different tutorials use different methods

viscid lichen
thorny forge
#

some of them work

#

all of them dont

viscid lichen
#

that's why they worked fine for you before

thorny forge
#

the problem is

#

how can I combine those 2 animations then

#

all I fucking wanted

#

is just to have the arms move separately from the legs

viscid lichen
#

I mentioned that the AvatarMask has two different sets of settings

thorny forge
#

but appareantly I need to recreate everything for that

viscid lichen
#

One is for Humanoid avatars.

#

The other works for Generic avatars.

#

You just pick which transforms the mask should cover.

thorny forge
#

i can try that

viscid lichen
#

This is less convenient, obviously, but it doesn't demand a Humanoid avatar.

#

To do this, just change your model back from Humanoid to Generic in the import settings

#

you may need to re-assign the avatar in the Animator

thorny forge
#

the only thing keeping my sanity alive rn is celeste music

viscid lichen
#

You will then need to check the appropriate boxes in the "Transform" section

thorny forge
#

yeah i figured that

#

do i want an avatar

thorny forge
viscid lichen
#

It can't be a humanoid avatar.

#

(and it should be created from the model)

thorny forge
#

okay good news

#

the walking and attacking animations work perfectly separately

#

but the problem of the attacking fucking up the leg still occours

#

even if it doesnt walk

viscid lichen
#

You need to set up the avatar masks correctly now.

#

that is, picking which transforms each layer is allowed to affect

#

you should be able to just uncheck everything, then check the two upper leg transforms to make the lower body mask

thorny forge
#

for some reason

#

the UpperSpine controls everything

#

if UpperSpine is set to affect the upperbody

#

the attack works perfectly

#

but the legs dont

#

and if the opposite is true

#

the legs work perfectly

#

but the attack doesnt

viscid lichen
#

show me the bone hierarchy

thorny forge
#

thatd be hard

#

there

#

mind you, like this it doesnt work

#

the attack that is

#

i need Upperbody both for the walk and the attack....

#

there is no way...

#

@viscid lichen the problem is that the upperbody also moves the legs

#

I have an idea maybe

#

I can remake the animation so instead of it moving the upperchest it moves the shoulders

#

@viscid lichen it works!

#

it doesnt look as good as it did

#

but i dont even care at this point

#

lemme send a vid

#

it doesnt look as forceful as it was before

#

because back then it used to move it's upper body, now it doesnt

#

but it starts to look natural when it does it during moving