News Forums RAIN General Discussion and Troubleshooting Sensor not working

This topic contains 14 replies, has 2 voices, and was last updated by  Cubiboy 6 months, 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #39926

    Cubiboy
    Participant

    Hello

    I try to finish my AI and setup 2 visual sensors to detect. To my Player I attached a Entity. In BT I wrote the Aspect and the
    sensor with quotes but it’s still not working. Also in a constraint happens an error: varHeroNearby != null && myHealth > 0

    Have you an idea to fix it?

    Thank you very much!

    #39927

    Sigil
    Keymaster

    Can you post a screenshot of your behavior tree?

    When you said the constraint has an error, do you mean that the expression is red or do you mean you are getting an exception in your console?

    #39928

    Cubiboy
    Participant

    Yeah here’s my BT: https://www.dropbox.com/s/9m7vy30irzgfcig/Screenshot%202016-01-21%2021.33.44.png?dl=0

    Yes the expression is red and there is written “Failure” (enemy found).

    Thanks for your help!

    #39929

    Sigil
    Keymaster

    OK, so I think the first issue is to switch the detect node from All Matches to Best. Currently All Matches returns a list of sensed aspects (even if there is only one) but the behavior tree can only really work with one at a time. All Matches is there if you want to create a custom action to do some additional work, and at some point we may support more in the expressions to actually go through that list in the behavior tree, not sure about that though.

    Try that and see if that fixes your detect issues.

    #39930

    Cubiboy
    Participant

    No… unhappily not… same issue or rather no issue, because nothing happen

    #39931

    Sigil
    Keymaster

    Did you set the other detect node to Best as well? If not make sure you set that as well. Even if it doesn’t fix the problem make sure you leave both of the detects on Best as it is the correct setting.

    #39932

    Cubiboy
    Participant
    #39933

    Sigil
    Keymaster

    The Entity and Aspect look good, let’s take a look at your sensors instead. I’m assuming you have two visual sensors, one named closeSensor and one named nearbySensor (maybe?).

    Given the constraint that is failing, it is likely the nearbySensor that is keeping it from continuing (from your first post, varHeroNearby is likely null). So perhaps a quick screenshot of both sensors so we can see what they look like.

    #39934

    Cubiboy
    Participant
    #39935

    Sigil
    Keymaster

    That looks good too. So I went back and looked at the entity screenshot and I noticed something I missed. Use Unity Messages is unchecked on the entity, which will keep it from registering the aspects with our system (unless you have some other code calling the initialization functions). Double check that all of your AI and entities have that checked, unless you are handling it in your own code.

    #39936

    Cubiboy
    Participant

    NOW IT WORKS!!!

    Thank you very much man!!!

    Unchecked it to test and forget to check it again xD….

    #39937

    Sigil
    Keymaster

    Glad we got it working.

    #39938

    Cubiboy
    Participant

    No I have an other problem… if the Enemy sees me and attacks me and I run away he rans towards me but if I’m too far away his animation stops and doesn’t run the “enemy not found” constraint…
    https://www.dropbox.com/s/2tyxpvfdibj0wbg/Screenshot%202016-01-22%2020.54.41.png?dl=0

    Thanks a lot for your time you waste for me!

    #39941

    Sigil
    Keymaster

    It’s not a waste, no worries.

    So it looks like you have your constraints set to repeat forever, which will block any chance of the constraint failing, keeping it from moving past the first one.

    I imagine the reason you added the repeat is that your guy got stuck somewhere in the tree after doing something once (like attacking). Check your parallel node at the top and make sure the Fail and Succeed options are both set to Any. The tie breaker won’t matter in that case.

    #39947

    Cubiboy
    Participant

    Thank you very much, that fixed it!!

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.