Bobbing head on an animated character...

I have an animated character that will be riding on a horse, etc. in my game. I’m trying to figure out how to have her head bob up and down realistically as she rides. The faster she rides, the more her head will bob, and the slower she does, the less it will, until it comes to a stop.

My solution so far has been to create a proxy bobbing object jointed to another object which is then connected to the neck bone in the characters skeleton. I pass the position and rotation info of the proxy “bobber” to her head in a LateUpdate and get “sort-of” a result.

The first issue I have is that I am already using the “Head Look Controller” script on her head (it works great!) to have her look at the camera, etc. and I need whatever solution comes up for the head bobbing to also work smoothly in conjunction with that script.

The second issue is that although I’ve found it easy to create jointed objects that hang down from another and swing nicely, it’s not the case when trying to have the hanging object sitting up on top (the head on the neck). Picture a spring with a ball attached on top, and the ball moves as the spring bounces. That’s basically what I need her head to do. No matter how I set up the ball so far though, it either just sits there as the “spring” moves, or flops over due to being too heavy.

I have a feeling I should be doing the bobbing via scripting (working the angles and all that) instead of with physical proxy objects, but that’s where I get a little lost.

Anyone have ideas for the best solution?

Thanks!

Hello!

If you have an animation for making the bobbing, you can just increase/decrease the animation’s speed and you should be good :smile:

and you can combine animations as well so your moving animation shouldn’t affect your other animations :slight_smile:

Using an animation is way easier :smile:

Hope it helps you! :wink:

Try this script from the wiki.

http://www.unifycommunity.com/wiki/index.php?title=Headbobber

I was under the impression that that script “simulates” bobbing by setting a certain bobbing value, but I don’t think it dynamically updates itself based on the speed of the object it’s attached to. I’ll give it a shot though and see what happens.

Yeah I might end up having to do that, but I was really hoping to have it be totally dynamic based on the angle of the head, the speed she’s going, etc. etc. I’ll try anything though at this point, heh.

Hello!

I’m just saying that it’s easier with an animation ;), and I don’t think it will really noticeable the angle of the head, will it?

Well for instance, her head needs to bob not only front to back but side to side as well depending totally on the motion of the horse she’s on. She can also turn her head from side to side and the bobbing needs to work with those angles as well. It seems impossible to account for all variations based solely on pre-made animations. I’ll give it a try though.