Seek Transform - arrive distance (A*)

MagicTimm

Member
Hi,
the Seek Tranform task return nothing because the NPC cannot reach the target. I thought Arrive Distance will solve this problem. If I add to the grey box (the target) a separate waypoint, put it a little bit outside of the grey box and use this as a target it works fine. But this is not my goal. The NPC should go to the box from every side. So I need a small radius arround the box and I thought this is Arrive Distance.
Hope you can help.

BT_transformseek.png
 
The arrive distance determines when the task should return success. The path that the agent takes to get to the destination is determined by the underlying pathfinding implementation.
 
Thank you Justin. As you can see the distance of the npc and the box is under 10 (I think). But the task does not return failure or success. The NPC stands in front of the box. The task is always green in the BT Designer.
 
If you place a breakpoint within Seek.OnUpdate can you tell why it doesn't return success?
 
The problem might be there:
In IAstarAIMovement class
protected override bool HasArrived()
{
var direction = transform.InverseTransformPoint(agent.destination);
if (use2DMovement) {
direction.z = 0;
} else {
direction.y = 0;
}
Debug.Log("arriveDistance.Value = " + arriveDistance.Value);
Debug.Log("direction.magnitude = " + direction.magnitude );
return direction.magnitude < arriveDistance.Value;
}

The arrive distance is always 2 after the character stopped. So the return value is false.
1609939626499.png

But (sorry) if I deactivate the Character Controller (the one from Unity), add a Rigidbody Component and left the Arrive Distance = 3 the NPC walks in the box and Seek Transform returns success
With arrive distance = 2 he stops in front of the box but not return success or failure.
bt_box.png
 
If you set the arrived distance to 10 why does debugging it print out 2? Could it be a different task that you are debugging?
 
No. If you look at the inspector in the task of the tree while the game is running the value is 2. But it works now. Don't really know you I solve this.
 
Hi, this problem happend only sometimes. Seek transform task and arrive distance = 4.5. Don't know why this happen. The pathfind works correct all over. With this exception.
Do you know what could be the resason or what I have to check?

1610658259951.png
 
Checking the arrived distance within the HasArrived is the right place to check. I would place another breakpoint there to verify things look good.
 
Top