Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Model or Object Animation Based On Player Inputy

Discussion in 'Animation' started by Xymbiot3, Sep 16, 2013.

  1. Xymbiot3

    Xymbiot3

    Joined:
    Sep 16, 2013
    Posts:
    10
    I am currently working on a puzzle game where I built the puzzles to use the GUI objects Unity provides. However, I'd like to light them and give them animations and such, so I think a 3D solution might work better (it's in a 3D world with a first person camera).

    Let me setup a quick scenario: The player walks up to a box with 3 buttons on the front. When a button is pressed, it slowly moves back into the box and then out again (as if the button was pressed in). Based on some combination, a puzzle is solved (though this is less relevant in the scenario).

    Is this possible to do with a model developed in an external modelling program like Blender? How would you know which button animation to press?

    The only quick solution I could think of was checking a ray from the camera center to see if it intersects a trigger volume over the button on the mesh and if so, play the animation for that button. But this doesn't seem that efficient?

    My other consideration was build the box and buttons separately inside Unity and animate them through code using trigger volumes.

    Any ideas on how to play different animations of a model based on the user view/activation?

    (Also, if there is a more general forum for this type of question feel free to move this thread).
     
  2. Xymbiot3

    Xymbiot3

    Joined:
    Sep 16, 2013
    Posts:
    10
    I think I have settled on a solution. I will be using the unity ray cast to determine a selection based on the intersection of the ray and a specific trigger volume.
     
unityunity