Feedback why ConditionTask OnDrawGizmosSelected didn't work

Forums 💬 NodeCanvas 🗨️ General Discussion Feedback why ConditionTask OnDrawGizmosSelected didn't work

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14188
    q755456
    Participant

      why ConditionTask OnDrawGizmosSelected and OnDrawGizmos don’t work?

      i can’t see the Gizmos in sceneview

      #14191
      Gavalakis
      Keymaster

        Hello,
        Have you override the OnDrawGizmos and OnDrawGizmosSelected method like the following?
        public override void OnDrawGizmosSelected(){ }

        Let me know.

        #14190
        q755456
        Participant

          windouws7 unity5.3.5
          I use the built-in task.I also selected the task but didn’t see the gizmos.

          using NodeCanvas.Framework;
          using ParadoxNotion.Design;
          using UnityEngine;

          namespace NodeCanvas.Tasks.Conditions{

          [Name(“Target In View Angle”)]
          [Category(“GameObject”)]
          [Description(“Checks whether the target is in the view angle of the agent”)]
          public class IsInFront : ConditionTask<Transform> {

          [RequiredField]
          public BBParameter<GameObject> checkTarget;
          [SliderField(1, 180)]
          public BBParameter<float> viewAngle = 70f;

          protected override string info{
          get {return checkTarget + ” in view angle”;}
          }

          protected override bool OnCheck(){
          return Vector3.Angle(checkTarget.value.transform.position – agent.position, agent.forward) < viewAngle.value;
          }

          public override void OnDrawGizmosSelected(){
          if (agent != null){
          Gizmos.matrix = Matrix4x4.TRS(agent.position, agent.rotation, Vector3.one);
          Gizmos.DrawFrustum(Vector3.zero, viewAngle.value, 5, 0, 1f);
          }
          }
          }
          }

          #14189
          Gavalakis
          Keymaster

            Hello,

            The only reason that the gizmos of that specific task (as well as most of them) will not show, is when the ‘agent’ is null, since the agent is required to view the gizmos at the correct world coordinates.

            The agent can be null, if for example you have set the agent to read from a blackboard variable which is null. In the image bellow, “myGameObject” variable on the blackboard is not yet set (null) and as a result in this case, the gizmos will not be shown. Otherwise the gizmos should show as expected.
            [attachment file=”NullAgentVariable.png”]

            Let me know if that’s the case.
            Thanks.

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.