I’m working with Unity 2.5. I’ve imported a puppet created using Blender. I’ve copied the puppet from Project to Hierarchy view. When I select the game tab I see the “on-screen view” I wish game users to see. To prototype the game before buying the iPhone module I’d like to map a key (such as up arrow) to an action such as squeezing the puppets head but I’m stuck and can’t figure out how to get started making a single key perform an action against the puppet. Would someone be able to point me to documentation which shows how to proceed?
To detect and respond to key presses have a look at the Input class documentation. The Input class provides you with access to various input mechanisms (desktop/web) like the mouse and/or key presses. When you go over to the iPhone then you’ll also want to look into the iPhoneInput class for things like multi-touch, accelerometer, etc.
For animation playback information look at the Animation class documentation as it’s how you’ll trigger, play, blend, cross-fade, etc. animations.
Thanks for the tips. They helped a lot. I now have a script attached to the gameobject and the script is responding to keyboard inputs. The one issue I have is how to reset the original gameobject state.
When the game starts a specific element of the gameobject animation sequence is displayed. After pressing a certain key a different element is played. The problem is how to play an element in response to a key then play the startup element until another key press.
The Animation class has a boolean variable called isPlaying which will be false when the animation has run to completion. You can just check this in the Update function while the second animation is playing and then restart the original animation when it has finished.