Destructible terrain, follower entities are stuttering in place when in crater

  • A* version: 5.3.6
  • Unity version: 6000.1

I started using A* recently and i am working on a RTS game. I am destroying terrain, and then recalculating the graph in the locations where its needed.

Recalculating graph function

It dosnt do a perfect job but good enough, cause the units should still be able to walk in that crater since its not deep enough.
Terrain destruction and update of graph

Now the problem arises when i try to leave some of the units inside the crater. cause they are trying to go up but towards the graph but there is no need for that, they can just fall down.
Unit not falling towards the ground, keeps spasaming

My question is. is it possible to tell the Follower entity to stop trying to update the objects Y coordinate in the sense that the gravity still works but the entity stops trying to force y to go up?

Some solutions i was thinking about and wanted to hear your thoughts about them

  1. Make the unit model not follow the entity, and make the entity not use the gravity, so the entity just follows the graph. And the unit model apply custom gravity to them and let them follow the entity X and Z positions only (might have problems with slopes)
  2. Same as the first one only add a rigidbody that can only update the Y coordinate
  3. Take the path thats calculated and change its Y coordinate in the sense for each point cast a ray downwards and tell the object that that is its new path coordinate (this doesnt make a lot of sense to me but its an idea)

You could always turn off Gravity for your units and then control their Y position directly. I think the answer to this depends on how craters affect your gameplay- if they are simply supposed to be “no-go” places then you have other better options. Let me know what you need out of this :slight_smile: