I'd recommend switching your player character to using navmesh agent like your enemy is unless you are going to add jumping. Doors will be kind of a bitch to solve though unless you make them all loading screens, but you will have to solve that for the zombies anyway. If you want jumping then switch to CharacterController.
/agdg/ Halloween Game Jam 2016
A downloadable game
An attempt to make a 3D game from scratch in two weeks by someone with no scripting experience.
Minor coding support from DemonLeprechaun.
The sound effect is by NoKeys101 over on soundcloud: https://soundcloud.com/nokeys101
Controls: W and S to walk forward and backwards, A and D to turn. Q and E to strafe.
You only have 20 bullets, more than enough to kill the zombie who will chase you, use RMB to ready your gun and LMB to shoot it!
Find the key to unlock the locked door to win!
Press Esc twice to exit the game.
Download the zip file, extract it to wherever and run the .exe, I recommend running it in windowed mode.
Log in with your itch.io account to leave a comment.
There is no jumping so I could switch to Navmesh, I'm guessing that it would make wall collisions unneeded, but what other benefits would it have?
The reason I would prefer the navmesh in this situation:
- Don't have to tweak two different sets of navigation set ups.
- The navmesh is easier to visually debug than collision. It can be harder to setup since it bakes based on renderer meshes though.
- Navmesh does not allow for the player falling off into the void. This sounds like a joke but it was a serious problem on the development of some big games.
- Having the player pathfind is possible (can be useful for cutscenes or some interactions if you want to have much larger interaction regions than interaction alignment).
- Kinematic rigidbodies are difficult to tweak to a good spot for a player character. They are suited for physics type games but for a player character they tend to bounce around and clip through things too much.
There are some drawbacks too though. I haven't done 3D in a qhile but off the top of my head:
- Doors are tricky to do well. Its worse on AI though than for a player character. You can probably handle with either navmesh links or navmesh obstacles. I guess even for rigidbody or CC doors are a pain though.
- You need to add a kinematic rigidbody if you want to get trigger or collision callbacks.
- Other agents may try to walk around the player which could be a problem for zombies chasing the player. Once way around this is to have them approach a point that is between them and the player instead of the player center position.
- Different sizes of agent sizes are not supported so unless you want to do fancy workarounds your player needs to be the same navigation width as your enemies. This is probably not a problem as they are both humanoids. If you add dogs you will probably need to solve this anyway between zombies and dogs. You can do this using an iterative navmesh bake process where you dynamically create a mesh based on the first bake and then change navmesh layers to do the second. Thin enemies can walk on both layers but fat enemies only on one.
Probably for the time being its not important to change but when you get to a point you want to work on player character control I would recommend considering it. At some point when you get around to animations of zombies grabbing players send me a message or something since I have went to hell and back to make pair animations look good.