Hi, I’m evaluating the options to switch (parts of) my game to ECS. Regarding the pathfinding library, what is the state of ECS at the moment? Are there some premade systems for pathfinding for entities or plans to integrate this? Maybe parts of the follower entity could be used without big changes?
And even more important: are there plans to integrate unity physics and attached entity colliders somehow in graph scans?
The background of these questions is the following: I’m working on an RTS and thinking about converting the units to entities. As the game is also physics based, it would be ideal, changing the entire physics system to ECS, so projectiles, forces and colliders can all be handled in the same system.
However, since I also have other types of objects, like buildings, that are constructed at runtime, I wonder if there is a way to include their colliders in graph updates when they are converted to entities and to include colliders in the subscene. I did some initial tests, but it seems colliders of gameobjects that are attached to an entity are not considered for graph scans.
PS. Still kinda learning the concepts of dots, so sorry if the workflow or terminology is not totally accurate.
There’s a new movement script called FollowerEntity in the beta which uses ECS under the hood. It can be used completely without its monobehavior if you wish. The monobehavior is more of a convenient (but somewhat slow) wrapper.
However, it does not interact with the unity.physics ecs package yet. It uses the UnityEngine.Physics API (which I don’t think works with the unity.physics package? but to be honest I’m not 100% sure).
Thanks, I read through the source code.
So just to understand it correctly, I would pretty much use all the components mentioned in the archetype defined in the FollowerEntity, right?
The GravityState is used for aligning the characters with the ground?
The normal Raycasting is using unitys PhysX engine as far as I know and this is different from the dots physics package, so raycasting will not return any result if hitting a dots collider.
However, the FollowerEntity allows to define a Movement Plane Source. If this is set to Graph, what exactly happens? Does it use raycasting under the hood anyways?
In this case I guess I’d need to either use the movement system without gravity and run an additional custom GravitySystem or rewrite the AIMoveSystem and replace the raycasting algorithm with a dots physics raycasting algorithm?
It is used for gravity. Moving the agents downwards and raycasting to check for intersections.
If the movement plane source is set to raycast, this raycast will be used to align the agent with the ground. Otherwise the agent will be aligned along the graph’s natural up direction. I strongly recommend keeping it set to Graph unless you have a spherical world, for performance reasons. If your agent needs to rotate to align itself with the ground in smaller ways, I recommend doing that separately from the pathfinding agent.
Do you have any plans to include unity physics (dots) in general?
I think it could be quite beneficial for recast graph scanning/updates and potentially also for RVO.
Also in regards, that scanning entities will probably not work otherwise…
Edit: There is a github project that uses apparently dots physics to create a normal unity-navmesh. It looks rather simple, but maybe some principles can be derived from it.