FollowerEntity unit can move up hill but not down

I attached the FollowerEntity to my soldier on terrain with a grid graph and built a small hill to test movement. The soldier can move up the hill but after that he cannot move at all after reaching the top.

I used this code inside an Ienumerator:
path.destination = rallyPoint;
while (path.reachedDestination == false)
if(Vector3.Distance(rallyPoint, transform.position) > 1f)
anim.Play(“Idle Stand”);
path.maxSpeed = 3;
yield return null;

I did some Debug.Log while trying to make him walk back down the hill. hasPath and canMove are both true when I give a downhill rallypoint but the soldier still just marches in place.


Have you disabled gravity on the FollowerEntity? Or set gravity to zero in your project physics settings?

No, its enabled in FollowerEntity and project physics have it set to -9.81 in y.

He can go uphill if the hill is the first destination I send him to, but if I make a few movements on flat terrain and then click the hill he cannot move up either. It might somehow be related to previous commands. I put in a Debug.Log(“reached destination”); to make sure the Ienumerator is finished. He can handle infinite commands on flat ground but cannot walk up if he had a command on flat ground first.

Ok there are 2 angles the soldier can walk up and downhill from and one of them happens to be the start position. The hill is very shallow, less than 30 degrees everywhere and its only about 2 tall. Max slope on grid graph is set to 90 right now and even if it was too stead in some spots shouldn’t the pathfinder just go around it?

Fixed it. The culprit was this in my update function
if (direction !=
transform.rotation = Quaternion.LookRotation(direction);
Follower entity already adjusts direction and that bit of code was constraining it.
I calculated direction by
direction = rallyPoint - transform.position;
So in some cases that might go thru the terrain if there are hills there.

1 Like