Animate and transform a object at the same time

Hello hello,

is it possible to animate and transform an object (via script) at the same time?

I have a snake, which has a animation glide, but the rotation up/down of the head region should calculate via a raycast which measures the distance ground/head to avoid intrude into ground.


I will try to descripe it more clearly. I have a snake which has a glide animation. The snakebones are rotating about her y-achsis.
Now I want to rotate the white bone (about in the middle of the snake) via script on his x-achsis to keep a accurate distance from the ground to the head. But my c# rotation is overwritten with the glide animation. I just want to mix c# rotation an animation rotation additive.

Ok, you made a comment in the form of an answer. I converted to a comment. I believe your problem is because you are likely handling the head rotation via Update. You need to do this in LateUpdate() which is after the bones/animation have updated their rotation and positions. Having said that, you will likely also have to save the rotation every frame because the animation will just keep overwriting what you did.

Quaternion lastRot;

void LateUpdate(){

bone.rotation = lastRot;
//apply rotation
lastRot = bone.rotation;