[Beginner] Rotation constraint with Limit

Hi, I'm new to scripting. I setup character and need my bone using rotation constraint with limitation.

Such as eyelid (follow eye's movement but not when it look upward)

Such as finger's root (rotate as finger bends, but not in reversed way as you can see in attached GIF)

I found someone's post, and it said;

 

if currVal < minVal then minVal

if currVal < minVal then minVal

else currVal

 

So I set my variables,

 

currval=Parent_RotZ

minVal=angleaxis 20[0,0,1]

MaxVal=angleaxis 50[0,0,1]

 

But it happens to have error on minVal...

Since I'm new to script and rotation is much more complex than movement, I have no idea to proceed...

I really appreciate if someone could help me, thank you.

 

AttachmentSize
handrot.gif1.42 MB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Banana28's picture

I could fix it

I should have used DegtoRad. It was such simple.
Now it have become like this;

currval=DegtoRad Parent_RotZ
minVal=DegtoRad 20
MaxVal=DegtoRad 50
if currVal < minVal then minVal
else if currVal > maxVal then maxVal
else currVal

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.