mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-04-09 21:54:09 +08:00
fix: raycast not correctly targeting blocks
This commit is contained in:
@@ -169,7 +169,7 @@ void Player::update(float delta_time) {
|
||||
// calculate the block that is looked
|
||||
glm::ivec3 block_pos;
|
||||
glm::vec3 block_normal;
|
||||
if(ray_cast(glm::vec3(m_player_pos.x, (m_player_pos.y + 1.0f), m_player_pos.z), m_front, block_pos, block_normal)) {
|
||||
if(ray_cast(glm::vec3(m_player_pos.x, (m_player_pos.y + 1.6f), m_player_pos.z), m_front, block_pos, block_normal)) {
|
||||
m_look_block = std::move(LookBlock{block_pos, glm::floor(block_normal)});
|
||||
} else {
|
||||
m_look_block = std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user