- Home /
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.
are these obstacles are standard prefabs (shortPrefab for all short
objects and tallPrefab for all tall objects) or you have a terrain ?
Answer by tanoshimi · Jan 08, 2014 at 06:14 PM
I suggest you study the Mecanim GDC sample project, which does exactly this: https://www.assetstore.unity3d.com/#/content/9896
how to implement collision detection without using raycast?i'd like to know.
the way i'm doing it might be wrong but shouldn't those functions be used in a script attached to the obstacles and not the player.if it also works in a script attached to the player,it would be nice if you could just provide an example syntax. EXTRA INFO-i experimented with a script and an animation attached to obstacle itself which would play when the player entered it's collision bounds.i'm having trouble figuring out how to make the player himself detect collision and play the respective animation.hope that made sense to you
Your answer
Follow this Question
Related Questions
Assist with CollisionDetection 1 Answer
Pixel Perfection collision on 3d animated object 0 Answers
Collision detection for sprite 1 Answer