I am working on a FPS/MMORPG and ran into a problem at spawnpoints, when I enabled collision detection between players. Neither player would be able to move if both spawned at the same time, because both players would essentially be "trapped" within each other's meshes. What is the best way to resolve this problem?
|
The usual way to avoid this problem is to do a collision check before spawning the player, to make sure that the spawning area is clear of obstacles before spawning. In general, you want to have several different spawning positions (as many as possible), so that if one of them is blocked, you can spawn the player at a different one. If all spawning positions are blocked, then you need to delay spawning the player until one of the spawning positions becomes clear. (This is why you need lots of spawning positions, to keep a team of players from conspiring to grief their opponents by intentionally standing in all the available spawning positions and keeping their foes from respawning) Your extra spawning points don't even need to be in different parts of the world; it's very, very common to make "clusters" of spawning points that are very close to each other. This lets you still know approximately where players will spawn (which can be useful from a design point of view), but still have spawnpoints available for immediate use when a player doesn't immediately move after spawning. |
|||||
|
|
You might also consider just not having players collide with each other. Besides simplifying the spawn problem it also eliminates griefing such as door blocking. |
|||||||||||
|