max-mapper / voxel-engine

3D HTML5 voxel game engine
http://maxogden.github.com/voxel-engine
BSD 3-Clause "New" or "Revised" License
1.29k stars 219 forks source link

How to create block types that don't fill the whole voxel cube? #102

Open modmatrix opened 10 years ago

modmatrix commented 10 years ago

I'd like to have block types whose geometry only takes up part of a voxel - like the glass panes, slabs, and stairs in Minecraft.

  1. Is that currently possible? Do I need a special module? If so, which one?

That's my main question, but here are some bonus questions if you're feeling generous:

  1. If the answer to 1 is "yes": will my in-game avatar collide with the visible edges of the block, or with the edge of the voxel? For example, if I create a wall of glass panes, will I be able to move partway into that voxel (until I hit the actual glass), or will I hit an invisible wall (the edge of the voxel) just in front of the glass?
  2. If the answer to 2 is "you won't collide with the edge of the voxel": will the player movement routines handle these blocks in a sensible way? For example, if I create a ramp or stair block type, and I run straight into one, will I climb it?

Basically, I'd like to create a game world that allows you to move from lower locations to higher ones without having to jump constantly.

max-mapper commented 10 years ago

I don't think this is possible at the moment unfortunately, all the collision code assumes regular cubes (https://www.npmjs.org/package/collide-3d-tilemap, https://github.com/chrisdickinson/aabb-3d)

modmatrix commented 10 years ago

Okay - thanks for the reply!

deathcap commented 10 years ago

https://github.com/maxogden/voxel-engine/pull/103 has experimental support for custom voxel rendering models (via voxel-mesher/shader 0.13+, example use for glass panes: https://github.com/deathcap/voxel-glass) but player collisions treat them as solid cubes. To change this, I think voxel-physical and/or voxel-control would have to be updated (to recognize custom hit boxes).