player.get_selected_block

This commit is contained in:
MihailRis
2024-05-31 08:33:37 +03:00
parent 29ca6e969c
commit 74042b5c2a
13 changed files with 32 additions and 18 deletions
+3 -3
View File
@@ -166,7 +166,6 @@ void CameraControl::update(const PlayerInput& input, float delta, Chunks* chunks
}
}
glm::vec3 PlayerController::selectedBlockPosition;
glm::vec3 PlayerController::selectedPointPosition;
glm::ivec3 PlayerController::selectedBlockNormal;
int PlayerController::selectedBlockId = -1;
@@ -362,11 +361,11 @@ void PlayerController::updateInteraction(){
maxDistance,
end, norm, iend
);
if (vox != nullptr){
if (vox != nullptr) {
player->selectedVoxel = *vox;
selectedBlockId = vox->id;
selectedBlockRotation = vox->rotation();
selectedBlockPosition = iend;
player->selectedBlockPosition = iend;
selectedPointPosition = end;
selectedBlockNormal = norm;
int x = iend.x;
@@ -443,6 +442,7 @@ void PlayerController::updateInteraction(){
} else {
selectedBlockId = -1;
selectedBlockRotation = 0;
player->selectedVoxel.id = BLOCK_VOID;
}
if (rclick) {
if (item->rt.funcsset.on_use) {