afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
988 stars 68 forks source link

Implement door and transition voxel clicking in game world #124

Closed afritz1 closed 6 years ago

afritz1 commented 6 years ago

This feature will allow the player to click on voxels and sprites to interact with them.

Currently I am thinking of doing a 3D ray casting algorithm that will step through the voxel grid until an intersection occurs, and it will retrieve the intersection data (distance, point in space, voxel coordinates, normal, voxel type).

Certain voxels like fences and store signs probably do not register a hit, so there should be some collision mask capability (or simply ignoring certain voxels in the ray caster).

afritz1 commented 6 years ago

Added barebones proof-of-concept functionality in commit 4c627ff2b34d2f7bb47f82651dcb619fac5a8c8a. I can now actually click on some blocks. The player can delete wall blocks by clicking on them or by pressing E in modern mode.

Things still left to do:

afritz1 commented 6 years ago

I'm going to split up this issue into more pieces since some of them are already solved (doors, MENU voxels) and others will probably not be solved until they're being implemented (entities).