Skip to content
Snippets Groups Projects
Commit 5987536f authored by Fabian Heinrich's avatar Fabian Heinrich
Browse files

Flag for disabling squeezing into other players.

parent 5722a629
No related branches found
No related tags found
1 merge request!44Resolve "GUI Player Management"
Pipeline #45575 passed
......@@ -33,6 +33,9 @@ from overcooked_simulator.utils import create_init_env_time, get_closest
log = logging.getLogger(__name__)
PREVENT_SQUEEZING_INTO_OTHER_PLAYERS = False
class ActionType(Enum):
"""The 3 different types of valid actions. They can be extended via the `Action.action_data` attribute."""
......@@ -485,12 +488,16 @@ class Environment:
new_positions[collision_idxs[idx]] = player_positions[
collision_idxs[idx]
]
# # Check if two moving players collide into each other: No movement (Future: slide?)
# distances_players_after_scipy = distance_matrix(new_positions, new_positions)
# collision_idxs = distances_players_after_scipy < (2 * self.player_radius)
# collision_idxs[eye_idxs] = False
# collision_idxs = np.any(collision_idxs, axis=1)
# new_positions[collision_idxs] = player_positions[collision_idxs]
# Check if two moving players collide into each other: No movement (Future: slide?)
if PREVENT_SQUEEZING_INTO_OTHER_PLAYERS:
distances_players_after_scipy = distance_matrix(
new_positions, new_positions
)
collision_idxs = distances_players_after_scipy < (2 * self.player_radius)
collision_idxs[eye_idxs] = False
collision_idxs = np.any(collision_idxs, axis=1)
new_positions[collision_idxs] = player_positions[collision_idxs]
# Collisions player world borders
new_positions = np.clip(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment