Location Based Animation

Can an animation be dependent on the location of an object.

For instance, if a character is over a mesh that represents water, the character displays a swimming animation. If over a mesh representing land, a walking animation is displayed.

You can easily say something like if(inWater) animation.CrossFade("swim")). The real question is, how does your game know you are in the water, or falling, etc… ? For example, say you have a swim fatigue meter which you somehow start it when you are in water. If you can do that, just tack on “swim” animation.

For water, possible to check the dominant texture painted on the ground, or make a triggerBox over the water area. For jumping, can check the grounded variable.