youvsvirus / youvsvirus-unity

Unity version of the you vs virus game.
GNU General Public License v3.0
1 stars 1 forks source link

Added edge colliders linke to viewport #67

Closed maccxs closed 4 years ago

maccxs commented 4 years ago

These edge colliders are linked to the viewport only and change if we adapt the screen size.

holke commented 4 years ago

Some NPCs seem to be able to sneak out of the colliders and are then trapped at the top of the map between the collider and the Top: grafik

In the above picture, the player is not able to move up due to the barrier and the NPCs at the top (higher than the player) are not able to move down.

holke commented 4 years ago

There is an additional barrier, quasi along Hohe Straße that permits the player from moving to the right:

grafik

In this pic, the player is not able to move further right. However, when the player spawns to the right of Hohe Straße it can move in between Hohe Straße and the right barrier, but not to the left of Hohe Straße.

holke commented 4 years ago

These were tested on Windows 10 with Firefox.

maccxs commented 4 years ago

@holke Yes, indeed there was a collider which should not be there. Missed it somehow during my final test. Please try again and give me feedback.

holke commented 4 years ago

When i start the game in non-fullscreen this works nice now. I can switch to fullscreen and the edge colliders are at the same place as in non-fullscreen (as intended, so switching to fullscreen does not increase the space in which i can move).

However, when i start the game in fullscreen or restart the game in fullscreen (after starting in non-fullscreen), the colliders do not work and i can move up to the boundary.

maccxs commented 4 years ago

Circumvent removed colliders

So there is actually three things I did. Would be great if you could test in firefox which still does not work for me.

  1. Moved the AddCollider to the start script. Not actually sure this makes a difference. Had to adapt CreatePopulation because then a reference was missing.

  2. Added an actual Edge Collider in the editor so one will always be present.

  3. Made a check in Update: if screen changes, the collider points are adopted.