(Temporary) Fix corner collision issue
Changelog: - When player move diagonally into a corner, collision is missing. This is because collision is resolved one-by-one and will not move the player if the new position still causes collision. In this literal corner case, player will not be moved as the player collide with both solids and resolving in either direction would still result in collision in the new position, unless both is resolved at the same time. Temporary 'fix' this by not checking the new position. No real idea on how to solve this for now.scene_man
parent
c8ea03359c
commit
8d94943547
|
@ -140,7 +140,8 @@ static bool check_collision_and_move(EntityManager_t* p_manager, TileGrid_t* til
|
|||
|
||||
// Resolve collision via moving player by the overlap amount only if other is solid
|
||||
// also check for empty to prevent creating new collision. Not fool-proof, but good enough
|
||||
if (other_solid && !check_collision_at(ent_idx, p_ct->position, sz, tilemap, offset, p_manager))
|
||||
//if (other_solid && !check_collision_at(ent_idx, p_ct->position, sz, tilemap, offset, p_manager))
|
||||
if (other_solid)
|
||||
{
|
||||
p_ct->position = Vector2Add(p_ct->position, offset);
|
||||
if (dir_to_move == 0)
|
||||
|
|
Loading…
Reference in New Issue