youvsvirus / youvsvirus-unity

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

Margrit/socialdistancing #39

Closed maccxs closed 4 years ago

maccxs commented 4 years ago

We still adjust the radius of the collider. But we attached a second collider that keeps the former "narrow radius" for collision. If NPC encounters the player or the map limits we disable the collision with collider1. It will still collide with collider2. In this way the NPCs keep their distance from each other but not from the walls or the player. In addition, we adjust the bounciness of collider1, since more social distancing makes us less bouncy. This should also result in a lower velocity for more social distance. More social distancing makes us crave less friction, so we adapt that value as well.

maccxs commented 4 years ago

Hey,

I tried lots of possibilities. I like this one for now. But feel free to try something else out. Do I have to do anything about the colliders now? If so what specifically? Thanks for the comments!

ghost commented 4 years ago

I guess we can leave the colliders as they are; at least I wouldn't know what to change.

maccxs commented 4 years ago

Concerning the velocity: I tried that as well. But if they have less velocity the collision has less impulse and the stick together. Then, we would have to change the overall velocity. So far playing the game I find it ok.

maccxs commented 4 years ago

@FredyHennig : What if in the OnTriggerEnter2D of the infection, we ask if the actual position +/- spritze size of the human is in the infection radius? Then the "outer collider" would not count. Since the NPCs now have another closer collider, this would trigger as well, when they are really within the infection radius.

holke commented 4 years ago

Looks good to me. I did not have time to look at the code, but think @FredyHennig already did.

Think we can merge this, however i see two issues that may be changed in the future:

  1. Even with 100% social distancing the NPCs get rather close to each other. I think the visual effect should be more here. Can we double the distance?
  2. The NPCs do not keep social distance from the player, which i think they should, but seems to be more complicated to implement (especially when the player shoud be able to force break the distance).
ghost commented 4 years ago

@FredyHennig : What if in the OnTriggerEnter2D of the infection, we ask if the actual position +/- spritze size of the human is in the infection radius? Then the "outer collider" would not count. Since the NPCs now have another closer collider, this would trigger as well, when they are really within the infection radius.

@maccxs Sorry, I'm afraid I can't quite follow... Do you intend to increase the size of the trigger zone and add an additional check for distance, and this way solve the invulnerability problem?