mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
add ladder block rotation
This commit is contained in:
parent
e00038327f
commit
e2806fb19c
5 changed files with 32 additions and 1 deletions
|
|
@ -340,6 +340,19 @@ static int determine_rotation(
|
|||
if (camDir.z > 0.0f) return BLOCK_DIR_SOUTH | verticalBit;
|
||||
if (camDir.z < 0.0f) return BLOCK_DIR_NORTH | verticalBit;
|
||||
}
|
||||
} else if (name == "ladder") {
|
||||
if (norm.x < 0.0f) return BLOCK_DIR_EAST;
|
||||
if (norm.x > 0.0f) return BLOCK_DIR_WEST;
|
||||
if (norm.z > 0.0f) return BLOCK_DIR_NORTH;
|
||||
if (norm.z < 0.0f) return BLOCK_DIR_SOUTH;
|
||||
if (abs(camDir.x) > abs(camDir.z)) {
|
||||
if (camDir.x > 0.0f) return BLOCK_DIR_EAST;
|
||||
if (camDir.x < 0.0f) return BLOCK_DIR_WEST;
|
||||
}
|
||||
if (abs(camDir.x) < abs(camDir.z)) {
|
||||
if (camDir.z > 0.0f) return BLOCK_DIR_SOUTH;
|
||||
if (camDir.z < 0.0f) return BLOCK_DIR_NORTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue