Now that you have calculated the amount that the rotation needs to change, write the code to make the chest rotate slowly over time. This should look a lot like the animation code you wrote for the Chest-Bottom, so refer back to ChestScript to get hints on how to do this.
- Make a variable with
letfor what percent finished the rotation is and then calculate how far along your rotation should be by dividing the
- Use an if-statement to only execute the rest of the code if that percentage is less than 1 (the same thing as 100%).
- Multiply that percentage by the
rotationChange(in your correct axis) and add it to the
- Set the entity’s local rotation to that value.
And make sure you increment
elapsedTime by the game frame delta time.