voxel / voxel-example

minimal example of voxel-engine-stackgl
http://voxel.github.io/voxel-example/
7 stars 6 forks source link

Raycasting broken, only finds voxels the player is within #2

Closed deathcap closed 8 years ago

deathcap commented 10 years ago

Clicking triggers onFire which in the demo sets the voxel located at game.raycastVoxel(), but this only matches voxels the player is actually located inside:

screen shot 2014-05-05 at 8 57 40 pm

(picture above shows the player inside the solid stone voxels, clicking to place)

On the other side of the valley (inside it, within air voxels), game.raycastVoxels() always returns false. Since maxDistance defaults to 10, it should at least match voxels ten blocks away.

raycastVoxels() is implemented using: https://github.com/mikolalysenko/voxel-raycast - which only depends on the getBlock() API, so that's likely broken in deathcap/voxel-engine#ndarray, somehow.

edit: raycasting not raytracing. Check the camera direction vector.

deathcap commented 8 years ago

voxel-example no longer includes an example of raycasting, but testing with voxel-example and adding voxel-outline 0.4.3 and voxel-voila 0.6.0, raycasting appears to be working correctly:

screen shot 2016-01-18 at 10 42 53 pm