Hi,
I use GridGraph.Linecast method to check if the unit’s moved is hit obstacled grid, then I get the GraphHitInfo. I found whatever degree by moved, the hit.tangent always return (0,0,-1) ( unit is one the side right, obstacle is on the side left) ?
GraphHitInfo hit;
var obstruct = AstarPath.active.data.gridGraph.Linecast ( GoComponent.LogicPosition, nextPos, null,
out hit );
if ( obstruct )
{
Vector2d hitp = hit.point;
Vector2d vector = hit.tangent;
int degree = (int) ( Math.Atan2 ( vector.y, vector.x ) * Mathf.Rad2Deg );
CLog.Debug ( $"degress:{degree}" ); // always = -90
speedVector = Singleton<GameInput>.Instance.GetDegreeVector ( degree );
dist = speedVector * FixedMath.Create ( Speed ) * deltaSecond;
nextPos = GoComponent.LogicPosition + dist;
GoComponent.LogicPosition = nextPos;
}