how to get the index of x y z | how to get x y z from index inside a 1D array Javascript (web)
Channel:
Subscribers:
513
Published on ● Video Link: https://www.youtube.com/watch?v=ctvMLSTgD90
code:
let chunk_of_data = new Uint8Array(32*32*32)
function getIndex(x, y, z){
return x + y*32 + z*32*32
}
let block1 = getIndex(2, 4, 2);
console.log(block1)
function getPosition(index){
let x = index % 32;
let y = Math.floor( index / 32 ) % 32;
let z = Math.floor( index / 32 / 32)
return {x, y, z}
}
console.log(getPosition(block1))
Other Videos By Player130
2024-07-04 | Making a roblox game #1 |
2024-07-04 | Making roblox beat saber |
2024-07-02 | Zy teaches you roblox lua |
2024-06-29 | Zy makes a roblox game |
2024-06-28 | Making a roblox game |
2024-06-28 | Zy streams fl studio |
2024-06-02 | Demo 001 |
2024-05-18 | Xy tries to make a video (attempt) |
2024-05-11 | attempting to use the quadratic formula speedrun |
2024-04-26 | how to reduce or precisely save memory in your javascript program (web) |
2024-04-26 | how to get the index of x y z | how to get x y z from index inside a 1D array Javascript (web) |
2024-04-25 | Zy makes an app |
2024-04-24 | How to Output and Input in Javascript (web) |
2024-04-12 | livestreaming game development in a web browser |
2024-03-26 | Coding stream |
2024-03-23 | Zy makes a parser live (SLOW) |
2024-03-22 | Echo - Crusher-P [WebITG 0.1] |
2024-03-21 | why it laggin like that |
2024-03-16 | Falling petals - Rairiku [NotITG] |
2024-03-10 | PSYQUI - Education [NotITG] |
2024-03-05 | unfinished modchart ill never finish |