Has Entered Trigger not triggering even though re-evaluated

Hi,

For some reason my Has Entered Trigger node is not triggering. I know the collision is being registered cus I have plenty of other scripts attached to the GameObject that use OnTriggerEnter that works fine.

The node is being re-evaluated so it should work, what could I be missing?

1691311721373.png
 
After some debugging it seems if my tree is in the "Move towards" branch, it doesnt work. If I disable that branch it works. Why would this change anything? It should still be re-evaluating and interrupting when tree is in "Move towards" branch?

Even if I disable all nodes in this branch except "Within distance" it still does not work (within distance is returning success every frame the trigger collides since player is close).

If I change the branch to this, it works fine:

1691313528564.png
 
Last edited:
What does your tree look like when Move Towards is active? Are you getting any errors?
 
What does your tree look like when Move Towards is active? Are you getting any errors?
No errors, can also be reproduced using only the "Within distance" node, while this node is active Has Entered Trigger is never called. If I disable the branch with "Within Distance" it works fine:

1691414049059.png
 
Ah, make sure you always have at least one task active within that branch. What is happening is that Has Entered Trigger is returning failure so it then goes to Within Distance. Within Distance is returning success so the top Selector then ends and branch never needs to reevaluate since Within Distance returns success.
 
Ah, make sure you always have at least one task active within that branch. What is happening is that Has Entered Trigger is returning failure so it then goes to Within Distance. Within Distance is returning success so the top Selector then ends and branch never needs to reevaluate since Within Distance returns success.

I just disabled the other 2 for demo purpose, I have the same issue when the tree is in the "Move Towards" node which returns running.
 
Can you show the tree in that state?
Sure!

Code:
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;
using UnityEngine;

namespace Assets.Scripts.CustomWander
{
    [TaskDescription("Move towards object using the Unity NavMesh.")]
    [TaskCategory("Custom/Movement")]
    [TaskIcon("c8e612848487a184f9090d416c932c47", "812dc79fe1e417548959f61845528372")]
    public class MoveTowards : NavMeshMovementBase
    {
        public SharedGameObject target;
        public SharedVector3 targetPosition;

        public override void OnStart()
        {
            base.OnStart();

            SetDestination(Target()); // Must set in start to make sure HasArrived doesnt return wrong result
        }

        public override TaskStatus OnUpdate()
        {
            if (HasArrived())
            {
                return TaskStatus.Success;
            }

            SetDestination(Target());

            return TaskStatus.Running;
        }

        // Return targetPosition if targetTransform is null
        private Vector3 Target()
        {
            if (target == null || target.Value == null)
            {
                return targetPosition.Value;
            }
            return target.Value.transform.position;
        }
    }
}

1691569115089.png

If this is also because MoveTowards returns success then how am I supposed to structure this tree? Knockback can be applied by a meele attack so WithinDistance and MoveTowards will always be true when it happens.
 
This is a result of Move Towards returning success. You could place a Return Failure above the middle Sequence task so it will then go to Wander. You just need to find a way to keep the branch active.
 
Top