Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 2: Making Code Respond to Players

Create the Other Animation Variables

You don’t have access to this lesson
Please register or sign in to access the course content.

Just like with the ChestScript, we need some more variables to track how long the animation should go, how long it has gone so far, and where the object started.

  • Add the animationTime variable, which should be public so that we can change it later. You can set it to 0, or pick a more logical number of seconds for your animation to last, like 2 or 3.
  • Create a private variable for elapsedTime that starts out at 0.
  • Create another Euler variable for startingRotation