xebia/von-grid

Name: von-grid

Owner: Xebia BV

Description: Hexagonal & square tile grid system with three.js

Created: 2016-07-08 08:47:10.0

Updated: 2017-12-14 08:27:42.0

Pushed: 2016-07-08 08:48:07.0

Homepage:

Size: 2740

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

3D hex tile system

screenshot

I never found a good (and free!) library for creating perfect hexagons and arranging them in a grid. But I did find Amit's wonderful explanation, and finally had the time to throw something together.

You can use the Board class with different graph types (hex and square), or you can make your own if you implement the interface.

Please use this to make awesome hex-based web games. Or port the code and make awesome hex games there. Just make awesome hex games, ok?

Features
Roadmap
Usage
Basic board

screenshot

scene = new vg.Scene({ // I made a very handy util for creating three.js scenes quickly
cameraPosition: {x:0, y:150, z:150}
rue); // 'true' or a config object adds orbit controls

grid = new vg.HexGrid();

.generate({
size: 4


board = new vg.Board(grid);

d.generateTilemap();

e.add(board.group);
e.focusOn(board.group);

te();

tion update() {
scene.render();
requestAnimationFrame(update);

Examples

For the simple examples you can drop them into Chrome, but for ones that require images or models, you'll have to run gulp serve-examples. A browser tab will be opened to the examples directory for you.

Editor
Try it out

screenshot


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.