Posted 20 January 2014 - 12:06 PM
I saw Immibis's Adventure Map Interface, and I loved it. I wrote a few Worldedit-esque programs, some that emulated //removenear (which could be changed to replacenear by adding a variable), some that were used like //set using the adventure map interface, one that made flat bedrock and emptied the chunk within X radius…etc. (So I do know a decent amount about coding in CC, even if I didn't make an account here)
I want to make a program functionally similar to WorldEdit's normal cuboid selector (because the poly or spheroid selector is far beyond my ability) but I need to know how to use the normalized direction vector from a player (ent.getLooking(x, y, z) returns it) to find out what block the player is looking at. From what I understand, what needs to be done is:
1) Extend out the vector linearly. (This is where I have a problem!)
2) Detect all blocks within that line. (This is trivial if I can get the co-ords)
3) If the line hits a block, end it (break or return)
So, does anyone with more knowledge than me about vectors know how that would be written?
(And if anyone wants to help me in programming this, I would love to see how someone who's a better coder than me could do it)
I want to make a program functionally similar to WorldEdit's normal cuboid selector (because the poly or spheroid selector is far beyond my ability) but I need to know how to use the normalized direction vector from a player (ent.getLooking(x, y, z) returns it) to find out what block the player is looking at. From what I understand, what needs to be done is:
1) Extend out the vector linearly. (This is where I have a problem!)
2) Detect all blocks within that line. (This is trivial if I can get the co-ords)
3) If the line hits a block, end it (break or return)
So, does anyone with more knowledge than me about vectors know how that would be written?
(And if anyone wants to help me in programming this, I would love to see how someone who's a better coder than me could do it)
Edited on 20 January 2014 - 11:31 AM