Skip to content

Commit

Permalink
CollisionMoveSimple: Collide with 'ignore' nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat committed Feb 26, 2018
1 parent 359a940 commit 6c9df2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/collision.cpp
Expand Up @@ -279,7 +279,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
bool is_position_valid;
MapNode n = map->getNodeNoEx(p, &is_position_valid);

if (is_position_valid) {
if (is_position_valid && n.getContent() != CONTENT_IGNORE) {
// Object collides into walkable nodes

any_position_valid = true;
Expand Down Expand Up @@ -327,14 +327,17 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
cinfo.emplace_back(false, false, n_bouncy_value, p, box);
}
} else {
// Collide with unloaded nodes
// Collide with unloaded nodes (position invalid) and loaded
// CONTENT_IGNORE nodes (position valid)
aabb3f box = getNodeBox(p, BS);
cinfo.emplace_back(true, false, 0, p, box);
}
}

// Do not move if world has not loaded yet, since custom node boxes
// are not available for collision detection.
// This also intentionally occurs in the case of the object being positioned
// solely on loaded CONTENT_IGNORE nodes, no matter where they come from.
if (!any_position_valid) {
*speed_f = v3f(0, 0, 0);
return result;
Expand Down

0 comments on commit 6c9df2f

Please sign in to comment.