Making RichAI sticky to Recast Graph? [4.3]

hi,

how can i make RichAI sticky to Recast Graph? [4.3.x]

thanks.

Hi

Sticky in what way?

i want to stick ai on navmesh [Recast Graph] even has no gravity!

You can do something like

RichAI ai;

NNConstraint nnConstraint = new NNConstraint {
    distanceXZ = true,
};

void Start () {
    ai = GetComponent<RichAI>();
}

void LateUpdate () {
    ai.position = AstarPath.active.GetNearest(ai.position, nnConstraint).position;
}
1 Like

thanks …
but seems that ai.position is readonly!!

Ah. I mean

NNConstraint nnConstraint = new NNConstraint {
    distanceXZ = true,
};

void LateUpdate () {
    transform.position = AstarPath.active.GetNearest(transform.position, nnConstraint).position;
}
1 Like