Raising/Lowering Flashlight (JavaScript)

A friend and I recently started messing around with Unity. We decided to make a horror game, so I began on some things with the character.

I’ve been able to figure most things out, but I just can’t seem to get a flashlight model to raise/lower when a certain key is pressed like the lantern in Amnesia. I’ve tried to just alter the y value so that it can’t be seen by the main camera (in the FPC), but it ends up moving to the wrong place after a few times and does not run smoothly. If any of you haven’t played Amnesia, just think of a gun being raised and lowered.

I searched for an example but couldn’t find any. Could any of you more experienced programmers help a newbie out here? Any help would be appreciated.

I’m guessing that you’re setting transform.position rather than transform.localPosition, and if so, then you’re going to be moving the flashlight to an irrelevant place when you do this.

That said, you should probably be implementing this using an Animation instead.