I have a player and enemies, they can basically do same things like glide swim walk run jump etc etc.
Problem is player controlled by character controller and enemy by navmesh or a* pathfinding.
Maybe lets forget about my game and think about gta5. Basicly all npcs can do what player can. This is what i want as a result.
My main problem is ai is moving by setdestination and player by setting cc direction.
How should i design that?
I have a hfsm like this
-high level fsm that controls general behaviour like is attacking is interacting is doing somethıng
-under it there is movement fsm to control if its swimming gliding normal moving or in freeze etc
Even right now its hard to control this statemachines there is a lot of transitions to check
I’m not actually sure what the problem is but have you looked at behavior trees as an alternative to state machines? I think they were invented to address the problem of FSMs with too many transitions.
I forget the details with Unity’s built-in nav agent system but it likely works similar to most other packages. In most cases, such systems allow you to disable the automatic agent movement and simply read the desired velocity based on their current position and path. This information can then be fed as directional input information directly into your character controller.
I couldn’t really explain myself but after doing some more research on your 2 messages I found the right way.
I think I can overcome the state management difficulty I experienced by mixing Unity’s new behavior tree with hfsm.
In this regard, yes, probably the only way is to get the direction as you said and tell the character controller to move in that direction. Instead of dealing with these, I decided to make the player navmesh, although it has some disadvantages, I think it will do the job.