Skip to content

toqueteos/unity3d-voxel-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voxel Map Editor

This is a Unity3D project that refactors AlexStv's Voxel Tutorial.

Things I've changed:

  • Standarized code style.
  • Move everything inside the Voxels namespace.
  • Removed terrain generators. No caves, no trees.
  • Removed noise-related code.
  • Blocks are represented as ints instead of Block subclasses.
  • "Infinite size" map editor out of the box, start with a single block and build huge worlds.
  • World serialization uses gzip compression.
  • Modified tiles.png with two new tiles: sand and error.
  • Refactored some magic numbers to Assets/MapEditor/MapConstants.cs.

Why int instead of GrassBlock : Block ?

Blocks are static so just an id reference to some container that holds each block details should suffice for most cases.

This has the benefit of making serialization super easy and space efficient.

Map editor controls

  • LMB adds the current block to wherever you click, if possible. Default: Stone.
  • Tab switches between Add and Replace modes. Default: Add.
  • 1 switches current block to Cobblestone
  • 2 switches current block to Stone
  • 3 switches current block to Dirt
  • 4 switches current block to Grass
  • 5 switches current block to Sand
  • 9 switches current block to Error
  • 0 switches current block to Air
  • X toggle burst mode for LMB (Input.GetKey vs Input.GetKeyDown)
  • B backup world whatever is configured in MapConstants.SaveFiles. Default: <root>/maps.
  • RMD + WASD to move around the scene
  • RMD + E to move upwards
  • RMD + Q to move downwards
  • Escape pauses Unity Editor if in Play Mode

Map editor: two modes?

  • Add adds a block next to the clicked block.
  • Replace replaces the clicked block.

Licensing

I'm following the same licensing as AlexStv's original tutorial which can be found here.

Basically you are free to use this project however you like.

The only asset that's not allowed for commercial usage is the Assets/MapEditor/tiles.png.

It's very easy to replace with one made by yourself.

About

Model anything starting from a single 1x1x1 block

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages