Skip to content

dvandusen/threex.poolball

 
 

Repository files navigation

threex.poolball

threex.poolball is a three.js games extension which helps you build pool balls. It provides dynamically generated models of pool balls, so no model download needed. It may be fun to play with when you start with three.js, funnier than a plain sphere for sure :) You can use it for your bar games, having your characters bet when playing pool, or even your Marble Table games, as I did, adding cool granular sounds when the balls roll.

Show Don't Tell

A Screenshot

screenshot

How To Install It

You can install it via script tag

<script src='threex.poolball.js'></script>

Or you can install with bower, as you wish.

bower install threex.poolball

How To Use It

Here is the default usages

var mesh	= THREEx.createPoolBall();
scene.add(mesh)

this is with custom arguments

var mesh	= THREEx.createPoolBall({
	ballDesc	: '0',	// the text which gonna be written on the ball
	stripped	: true,	// true if the ball must be stripped, false otherwise
	textureW	: 512	// the width/height of the created texture for this ball
});
scene.add(mesh)

Some ball description are already done.

  • cue will return an unstripped white ball
  • black will return an unstripped black ball
  • 1 to 9 will assign the official colors for nine-ball pool

Possible Improvements:

  • to add a shaddow, something simple like in threex.pacman, or from a texture of three.js distribution
  • in demo.html make the ball starts behind the montains and disapears behind the montains too
    • thus no more appearing/disapearing glitch

Releases

No releases published

Packages

No packages published