I have been browsing for a while now, and cannot seem to find an actually complete tutorial that aligns with what I want for my game, which is an RPG that i need to have somewhat advanced enemies in. What I am looking for that I cannot seem to find in tutorials is how to use animations along with navmesh, how to apply force to an enemy using navmesh, and how to give them targets other than the player (like walls for instance). All of these are not required technically, but if I want to make my game look nice, these things should be included. So what I am essentially asking is can anybody point me in the direction of an actually detailed and thorough tutorial on how to create more advanced enemies than a cylinder that just chases me around? or multiple tutorials that align with each other to allow me to make a decent looking/functioning enemy? also, i don’t know if this changes anything, but I since enemies have to avoid obstacles, I think that navmesh is important to have for my enemies.
I think looking for a tutorial to a specific, complicated thing with respect to game design is a bit of a trap. Every problem in game dev, coding or otherwise, is usually made up of lots of small problems. Many of which can be tackled in isolation with any number of interchangeable solutions.
For example animating a character and moving a character on a navmesh are two separate problems, of which, really have nothing to with one another. You can tackle both in isolation, then combine them quite easily.
Break your goal down into smaller and smaller problems and learn the solution to each one - and more importantly, the concepts behind them. Build up that tool set and use that for future problems.
I will say that when I learned to implement my first animated player character, driven by a state machine, I learnt each part separately:
- First how to read input with Unity’s new input system
- Then how to make use of mechanim to animated an animated character
- Then how to code a state machine
After which I combined all three to produce a nice, animated player character.
With navmesh you move by setting its destination and it’ll move using the speed/configuration you set for that object.
With movement animations for locomotion you can calculate the rotation an object should face by the direction it’s moving, and take into account the speed it’s moving to influence the speed of the animation. Usually you’ll save the current position and next frame (or several later) compare the new current position with the previous and you can get the direction and speed they’re moving. Then you can use Quaternion.LookRotation to make the object face that direction.
On an animator you’d create a float property and have a state machine that blends between idle, walk, run based on that float value. Then based on that difference between frames you can adjust the float position to idle,walk,run,wak,idle automatically all based on that earlier move distance.
For shooting at a wall or whatever you can use an upper body ik to aim at an invisible object (or just rotate the character to face the target), then move that object to the point on the wall you want them to shoot and trigger an event that says fire the weapon.
I’d make some basic demo getting movement working and then raycasting and triggers and projectiles.