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:

Sry for the late replay. Units can pass trough the craters, but if the crater gets too deep they cant anymore.

In the end i decoupled the follower and the object (i told the follower not to update the position and rotation, doing that in another script + rigidbody), but i can already see an optimization problem in the future from that way (when there are a lot of units in the scene).

If i turn off gravity will it still go up? towards the follower?, or do you mean the y of the follower?

How would i go around doing that? i am trying to drag the FollowerEntity down on the Y as much as i can but its not going deep enough. Is there like a Y offset or something that i can make larger?

Cause it goes down a bit but when i try to force it to go more down (just trying to drag the transform down) it does not let me, it keeps pooping up.