-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Unity 4.x Game Development by Example: Beginner's Guide
By :

One small adjustment stands between you and a fun keep-up game mechanic. We want the paddle to angle in the opposite direction to keep the ball bouncing inside the play area. We can multiply by -1
to flip the effect:
var tiltAroundX : float = Input.GetAxis("Mouse Y") * tiltAngle * -1;
Save and test. Hooray! The paddle tilts around the play area inclusively, keeping the ball more or less within our reach—unless we get twitchy, and then we drop the ball. But that's the fun of keep-up—moving the paddle just so as to keep the ball in play.
Well, that was lots of fun! We've got a working keep-up game mechanic. Now let's go and do something else.
Oh, that? Don't worry about it. We have bigger fish to fry! In the next chapter, we'll…
Gosh, you're persistent. Can't you just leave it well enough alone?
I'm not going to sugarcoat it: 3D math is complex. A quaternion (like the one we used in our rotation code just...
Change the font size
Change margin width
Change background colour