mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 02:19:44 +00:00
feat: variant-based hitboxes
This commit is contained in:
parent
563001351b
commit
b8b2e4f451
16 changed files with 145 additions and 102 deletions
|
|
@ -459,7 +459,7 @@ void PlayerController::processRightClick(
|
|||
blockid_t chosenBlock = def.rt.id;
|
||||
|
||||
if (def.obstacle) {
|
||||
const auto& hitboxes = def.rt.hitboxes[state.rotation];
|
||||
const auto& hitboxes = def.getHitboxes(state);
|
||||
for (const AABB& blockAABB : hitboxes) {
|
||||
if (level.entities->hasBlockingInside(blockAABB.translated(coord)
|
||||
)) {
|
||||
|
|
|
|||
|
|
@ -468,7 +468,10 @@ static int l_get_hitbox(lua::State* L) {
|
|||
} else {
|
||||
rotation = 0;
|
||||
}
|
||||
auto& hitbox = def->rt.hitboxes[rotation].at(hitboxIndex);
|
||||
const auto& variant =
|
||||
def->variants ? def->variants->variants[get_variant_index(L, *def, 4)]
|
||||
: def->defaults;
|
||||
auto& hitbox = variant.rt.hitboxes[rotation].at(hitboxIndex);
|
||||
lua::createtable(L, 2, 0);
|
||||
|
||||
lua::pushvec3(L, hitbox.min());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue