+1 vote

I'm animating my character's eyes by changing the UV offset of the material along the x-axis, to make them squint, look left or right, blink, etc.

I am separately setting the y-offset with code, to change the style of the character's eyes (with lashes, without, etc). My problem is that the animation is overriding this y value and setting it back to 0.

Is there a way to make an animation control the x-offset without changing the y-offset? Or do I need to use a separate texture for each eye style?


in Engine by (32 points)
edited by

By animate with code, do you mean interpolation with Tween? If so, try:

interpolate_property(material, "uv1_offset:x", init_val, final_val, duration)

Otherwise, show us your code so that we can better understanding your frustration.

Thank you imjp94!

Sorry I was unclear, I'm not trying to animate with code, I'm changing the y-offset of the UVs with code and the x-offset with animation, but the animation was overriding my code changes.

Your answer pointed me in the right direction - I just had to add ":x" at the end of my animation track, and that fixed it.

1 Answer

+1 vote
Best answer

imjp94 pointed me in the right direction. I added ":x" to my animation track (it now looks like "armature/Skeleton/body:material/1:uv1_offset:x") and it no longer changes the y-offset.

by (32 points)

I added an ":x" to my framecoords, so it looks like "framecoords:x", and now it doesn't seem to let me add frames to the timeline. Also, this is the only place I've seen anything like this mentioned, so maybe I just did it wrong, can you give more detail on what you did, or possibly some screenshots, because if I can get this to work it'll save me a lot of time.

ok, I ended up finding it out. I just added key nodes before swapping it over to framecoords:x, then clicked on each frame and set the value. While yes it does work it's kind of annoying

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.