Exercises

Before we head on to the next part of the book, let’s take some time to complete the following exercises:

  • Since we’re not changing the view matrix on every frame, what could you do to optimize the updates to viewProjectionMatrix and invertedViewProjectionMatrix?

  • The puck currently reacts the same whether the mallet strikes it directly or on the side. Update the collision code to take the striking angle into account; Figure 43, Unit circle, might give you an idea of how to approach this.

  • Update the collision code so that the puck also interacts with the mallets when it’s moving on its own; for bonus points, make its motion frame-rate independent. Hint: Store your movement vector as units per second, and figure out how much time has ...

Get OpenGL ES 2 for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.