How to make my player play a vault animation when i collide into a vaultable object?

i’ve made two animations,one jump and the other vault:jump should play when the player collides with a short object and vault when a tall one(with reasonable restrictions of course).i’ve tried using the OnTriggerEnter function to no avail.i’d like to attach the script to the player(so as to not have to attach it to every obstacle).i need to know what to use to make the obstacle initiate the appropriate animation in the player based on the transform values it returns to the script in the player(where i intend to use a condition checking height and width of the object).sorry if it looks like i’m rambling but i’m stuck and would really appreciate some help.

I suggest you study the Mecanim GDC sample project, which does exactly this: Unity Asset Store - The Best Assets for Game Making