can you Add scripted animation to animated objects?

Hi there,

I was wondering, is there a way to add scripted animation to animated objects?
In my scene I have an animated character that I’d like to have lean a little as he changes direction but I don’t want to loose the animation that’s currently on the bones I’d be adjusting.

Is there a way to do this? I’d just like to add a little to the existing animation but I haven’t been able to get it working.

Thanks
Pete

Yes, you can adjust the bones in LateUpdate to apply an offsets on top of the animation that’s playing, eg

private var SpineBone : Transform;

function Start(){
	SpineBone = GameObject.Find("Spine 1").transform
}

function LateUpdate(){
	SpineBone.eulerAngles.y = SpineBone.eulerAngles.y + 90;
}

The other approach is to use an additive leaning animation with it’s Speed set to zero and adjust the Time value in script to the angle needed.

Hey thanks sycle,
I tried to blend an addivtive lean animation over the top but it only leans the character one way :frowning: It works fine in blend mode though(but that doesn’t really give me the result i’m looking for). I don’t know why it’s doing that, it’s a shame because it would have been perfect. I haven’t had much luck getting additive to work predictably yet.

So I might have to try the late update, that sounds like it might work!