joshheinrichs / cmpt306-project

A procedural generated dungeon crawler built in Unity.
0 stars 1 forks source link

Newly spawned player and Turret issue #9

Closed knames closed 8 years ago

knames commented 8 years ago

When a player is newly spawned, and a turret shoots at them, the object will not kill the player, but push it along the projectiles path.

joshheinrichs commented 8 years ago

i haven't been able to reproduce this, seems to be working fine for me.

Gedsaro commented 8 years ago

Having just been playing about with what is in develop I havn't noticed the turret thing, but it seems like zombies do not kill the newly spawned player until the player moves.

joshheinrichs commented 8 years ago

If the player hasn't moved, they'll just respawn at their current location. It might seem like he hasn't died, but he's probably just dying every frame. Maybe it's the same issue for the turret?

Gedsaro commented 8 years ago

Ah sorry, I meant to also say that while not killing the player who hasn't moved yet, the zombie is also pushing the player away from the starting position. Then once I move the player out of contact with the zombie, any new collision between the two proper kills and respawns the player at the spawn point.

While being pushed, i can even move the player into the zombie without dieing, or up/down, as long as I am still touching it no death occurs.

joshheinrichs commented 8 years ago

Ah interesting, I see what you're saying.

joshheinrichs commented 8 years ago

So what seems to be happening is that the zombie kills the player when it first collides. However, because the player respawns in the same position, it doesn't detect another collision event. The way to fix this is to not have the player spawn with something already colliding with it, or else it wont detect a collision.

joshheinrichs commented 8 years ago

I can't reproduce the turret issue, but I'd assume it has the same cause.

joshheinrichs commented 8 years ago

Looks like we could also use OnCollisionStay2D, but I don't know what the performance implications of that are.