Pane place direction fixed
This commit is contained in:
parent
d9bc17e9b6
commit
a691526693
@ -27,6 +27,7 @@ const float CROUCH_SHIFT_Y = -0.2f;
|
|||||||
|
|
||||||
using glm::vec2;
|
using glm::vec2;
|
||||||
using glm::vec3;
|
using glm::vec3;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
CameraControl::CameraControl(Player* player, const CameraSettings& settings)
|
CameraControl::CameraControl(Player* player, const CameraSettings& settings)
|
||||||
: player(player),
|
: player(player),
|
||||||
@ -218,7 +219,10 @@ void PlayerController::updateInteraction(){
|
|||||||
int z = (int)iend.z;
|
int z = (int)iend.z;
|
||||||
uint8_t states = 0;
|
uint8_t states = 0;
|
||||||
|
|
||||||
if (contentIds->getBlockDef(player->choosenBlock)->rotatable){
|
Block* def = contentIds->getBlockDef(player->choosenBlock);
|
||||||
|
if (def->rotatable){
|
||||||
|
const string& name = def->rotations.name;
|
||||||
|
if (name == "pipe") {
|
||||||
if (abs(norm.x) > abs(norm.z)){
|
if (abs(norm.x) > abs(norm.z)){
|
||||||
if (abs(norm.x) > abs(norm.y)) states = BLOCK_DIR_X;
|
if (abs(norm.x) > abs(norm.y)) states = BLOCK_DIR_X;
|
||||||
if (abs(norm.x) < abs(norm.y)) states = BLOCK_DIR_Y;
|
if (abs(norm.x) < abs(norm.y)) states = BLOCK_DIR_Y;
|
||||||
@ -227,6 +231,17 @@ void PlayerController::updateInteraction(){
|
|||||||
if (abs(norm.z) > abs(norm.y)) states = BLOCK_DIR_Z;
|
if (abs(norm.z) > abs(norm.y)) states = BLOCK_DIR_Z;
|
||||||
if (abs(norm.z) < abs(norm.y)) states = BLOCK_DIR_Y;
|
if (abs(norm.z) < abs(norm.y)) states = BLOCK_DIR_Y;
|
||||||
}
|
}
|
||||||
|
} else if (name == "pane") {
|
||||||
|
vec3 vec = camera->dir;
|
||||||
|
if (abs(vec.x) > abs(vec.z)){
|
||||||
|
if (vec.x > 0.0f) states = BLOCK_DIR_EAST;
|
||||||
|
if (vec.x < 0.0f) states = BLOCK_DIR_WEST;
|
||||||
|
}
|
||||||
|
if (abs(vec.x) < abs(vec.z)){
|
||||||
|
if (vec.z > 0.0f) states = BLOCK_DIR_SOUTH;
|
||||||
|
if (vec.z < 0.0f) states = BLOCK_DIR_NORTH;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Block* block = contentIds->getBlockDef(vox->id);
|
Block* block = contentIds->getBlockDef(vox->id);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ void CoordSystem::transform(AABB& aabb) {
|
|||||||
aabb.b += fix2;
|
aabb.b += fix2;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BlockRotProfile BlockRotProfile::PIPE {{
|
const BlockRotProfile BlockRotProfile::PIPE {"pipe", {
|
||||||
// Vertical
|
// Vertical
|
||||||
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 0}},
|
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 0}},
|
||||||
// X-Aligned
|
// X-Aligned
|
||||||
@ -21,7 +21,7 @@ const BlockRotProfile BlockRotProfile::PIPE {{
|
|||||||
{{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {0, 0, -1}, {0, 1, 0}},
|
{{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {0, 0, -1}, {0, 1, 0}},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
const BlockRotProfile BlockRotProfile::PANE {{
|
const BlockRotProfile BlockRotProfile::PANE {"pane", {
|
||||||
// North
|
// North
|
||||||
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 0}},
|
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 0}},
|
||||||
// East
|
// East
|
||||||
|
|||||||
@ -29,6 +29,7 @@ struct CoordSystem {
|
|||||||
|
|
||||||
struct BlockRotProfile {
|
struct BlockRotProfile {
|
||||||
static const int MAX_COUNT = 16;
|
static const int MAX_COUNT = 16;
|
||||||
|
std::string name;
|
||||||
CoordSystem variants[MAX_COUNT];
|
CoordSystem variants[MAX_COUNT];
|
||||||
|
|
||||||
/* Wood logs, pillars, pipes */
|
/* Wood logs, pillars, pipes */
|
||||||
|
|||||||
@ -7,6 +7,11 @@ const int BLOCK_DIR_X = 0x1;
|
|||||||
const int BLOCK_DIR_Y = 0x0;
|
const int BLOCK_DIR_Y = 0x0;
|
||||||
const int BLOCK_DIR_Z = 0x2;
|
const int BLOCK_DIR_Z = 0x2;
|
||||||
|
|
||||||
|
const int BLOCK_DIR_NORTH = 0x0;
|
||||||
|
const int BLOCK_DIR_WEST = 0x1;
|
||||||
|
const int BLOCK_DIR_SOUTH = 0x2;
|
||||||
|
const int BLOCK_DIR_EAST = 0x3;
|
||||||
|
|
||||||
// limited to 16 block orientations
|
// limited to 16 block orientations
|
||||||
const int BLOCK_ROT_MASK = 0xF;
|
const int BLOCK_ROT_MASK = 0xF;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user