The Launcher

The launcher will be an arrow that points in the direction we want to launch the ball. Add the launcher arrow code just below the line with START CODING ON THE NEXT LINE.

​ ​var​ direction = ​new​ THREE.Vector3(0, 1, 0);
​ ​var​ position = ​new​ THREE.Vector3(0, -100, 250);
​ ​var​ length = 100;
​ ​this​.arrow = ​new​ THREE.ArrowHelper(
​  direction,
​  position,
​  length,
​  ​'yellow'​
​ );
​ scene.add(​this​.arrow);

We use an “arrow helper” to draw our launcher. We might replace it with an animated slingshot or something similar later, but an arrow will be just fine for our mini-game. The arrow needs a direction to point in (straight up), a position (a little down and ...

Get 3D Game Programming for Kids, 2nd Edition 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.