To calculate direction of casting depending on the players angle do something like this:
ax= cos(player.angle) -distance, ay = -sin(player.angle) -distance
Thank God! I've already passed this stage...
So you will need to nest arrays, and depending on player position access them, then arrays within them and place blocks accordingly. To do that each block has to have a boo that defines its availability.
I was trying to do some tests with that before, but I ran into a problem: Let's say that the player can Aim at the object 'ground' which is extremely large and it's origin point is centered, also let's say the player is right at the block edge, the "it's inside radius boolean" wouldn't detect because the tests I made only takes the player PosXYZ and object PosXYZ and don't take other important values to as its length...
How could I make this 'algorithm'/'formula' to detect the distance from player and block? Maybe I could use a: "is overlapping object", but then I must do this detection in a loop for all the object what wouldn't be very optimal...
Also, lest say your cube is 10x10x10, then you can repeat the ray test n/10 times, so per grid and not per pixel.
It's a great idea, not gonna lie. But it would be only for a cube exclusive game. Since objects with meshes that don't will the cubic format would be detecting even if the player isn't looking at it.
But everything you said gave me an idea... I will try my best to see if it works. Thank you! :D