Driver Animation Problem Creating a property Variable

Hey guys.

I’m trying to Have my driver for my shape key to have an if then statement.

Basically. if Bone var X Rotation == 90; shapekey var (Lets say Angry Face) = 1

That is simply what I’m trying to do but I dont know how to get the variable number Bone Rotation X value.

How do I get this X Value and put it into a property?

If i can figure that out everything should be pretty simple.

But I dont know how to get Bone X Rotation Value into a single Property / Variable.

1 Like

Just change the bones rotation to xyz-euler, then you can right click on your bones rotation-x value → copy as new driver, then you e.g. paste that on y-rotation value of a cube and you will get:

then just change it to scripted expression and use your variable as you like it:

so in my example you will get this:

driver example

Alright I appreciate your help.
But you lost me at the paste it on my Y Rotation Value.

I just need my Shape Key to set its value to one when ever I rotate it to a specific rotation.

Kind of like programing a character in a way.

I’ll give you an image example.

Her Joyful

Her Embarrassed

You see how my little box on the side rotated aswell?

I basically would like to add a driver for my shape key that sets its value from 0 to 1 if my Face Bone rotation rotates to that favored rotation. so Rotation = 90 (Sad Face) Rotation = -180 (Surprised Face)

Thats about it. I saw a tutorial where you can get the var property by creating a custom property and then Follow with an If Else Then statement.

But I dont know how to get my Face Bone X Rotation Value so I can place it in there.

Hold on I think I got what you were saying. Hold on

Well it appears my scripting is absolute ass.

Because I’m getting errors.
“It cannot contain spaces”
“It cannot contain special characters”

if you can send blend file, i will have a look. i can just assume…and i would rename your armature to something without “@”

Whats wrong with the @?

It keeps me organized so I wont have to scroll all over the place.

So I can always find it at the top.

And Alright I’ll upload it give me a second.

The package has been Delivered.

https://filebin.net/0zrzgk6esyw7oxp5/cassi_FK_only_0.2.blend

ok, you tried to SET a variable. You cannot do that. Just return the value will set it for the property you added that driver to.

try this:

1 if rotation_euler == 90 else 0

like this:

I’m still getting this error.

Its almost as if Blender isn’t registering it as a script function or something.

Oh wait LOL

I was typiny in the wrong prompt.

LOL

I got in the right location but it doesnt seem to be following along as it should be.

It doesn’t matter which rotation axis I move on It still doesnt seem to respond correctly. I tried greater than signs but it just isn’t following up properly.

i got the driver "kind of " working, but…it doesn’t update automatically. So i always have to go into the drivers editor and hit “update dependencies” → then it gets the right value. that’s a bit weird…

got it working now, use this:

by using this, it updates the driver automatically. Just use “var” as expression just to see that it works. If you got that, change the expression to your if statement.

result:

driver works now

Alright hold on. I swapped it to Quaternion and it seems like It’s A OK now.

I had it on the Y axis btw unfortunately. Sorry if that caused confusion.

Well its good but Now I realize I can accidently skip over the axis number making it appear as if nothing is working. Is there a way I can add “&” statement in there too?

Like

1 if Rotation >= 90 && <= 120 else 0

Oh wth howd you do that? Alright then that looks simpler

i changed the input variable to:

transform channel

image

type: y rotation

mode : xyz euler

image

local space

Alright I get that. But bro.

Now it’s ignoring the if then else statement.

Its just setting a value when ever I rotate it.