none
LDPhysics AI sensor detection RRS feed

  • Question

  • Hey Litdev, I'd like your advice with this here.

    If you remember back to the other post I wrote about getting a collisions at a location, you'll know that I was using sensors to guide bots. This works, but I have a problem with it. The sensor can easily get stuck on other sides of objects. The sensor is in open space, so it doesn't sense anything, but there is still a wall in between sensor and the bot. Here is a image to illustrate: 

    I was hoping you would have some Ideas about how to fix this.

    Thanks!


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Friday, December 4, 2015 3:50 AM
    Answerer

Answers

  • I added LDPhysics.RayCast as one solution, but could be useful for other stuff too (beta version uploaded), test sample LGP699.

    • Marked as answer by Zock77Editor Monday, December 7, 2015 6:19 PM
    Friday, December 4, 2015 4:27 PM
    Moderator

All replies

  • I will think about this and how to do best.  I am going to split as a separate thread topic.

    We could consider:

    1] Ray casting e.g. http://www.raywenderlich.com/4653/intermediate-box2d-physics-forces-ray-casts-and-sensors

    Issues: we may need to fire quite a lot of them to be sure of hitting small objects and therefre may be slow or complicated.

    2] Perhaps objects that detect collisions but don't interact so you could surround your car with a larger circle that detects objects but doesn't interact - I think this is possible.

    Iiisues - we also need to know where the contact was, would just the hit object be enough.

    Have a little think on these and reply with your thoughts.

    Friday, December 4, 2015 8:33 AM
    Moderator
  • Those are both really neat! I will think on that.

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Friday, December 4, 2015 4:25 PM
    Answerer
  • I added LDPhysics.RayCast as one solution, but could be useful for other stuff too (beta version uploaded), test sample LGP699.

    • Marked as answer by Zock77Editor Monday, December 7, 2015 6:19 PM
    Friday, December 4, 2015 4:27 PM
    Moderator
  • This seems to work fabulously! Check out this test program here and tell me what you think:

    JQL648

     

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Saturday, December 5, 2015 6:39 AM
    Answerer
  • Looks like ants - works well - I had to recompile the ZockMath extension.

    I also extended the raycast method to allow muliple angles to be checked and returning the angles hit, uploaded beta and test sample, MJK882 using a 360 separate rays - performance is better than I would have thought.

    Saturday, December 5, 2015 9:24 AM
    Moderator
  • Sorry about the extension. I need to re-upload it to mediafire.

    I'll give that program a test!


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Sunday, December 6, 2015 12:22 AM
    Answerer
  • Works great!!

    Do you have any ideas for making the bots smarter? They keep getting stuck in corners.


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Sunday, December 6, 2015 5:36 PM
    Answerer
  • Smarter is kind of hard.

    I guess I would start by:

    1. working out what their objective is, then
    2. what info do they have about surroundings then a
    3. strategy to achieve objectives based on info they have.

    So if part of the objective is to not get stuck in a corner - you need them to be able to detect this somehow - perhaps they haven't managed to move or they have to keep turing and getting nowhere - the strategy might then be to turn 180 degrees and try from there.

    There is no general rule for smarter and I think you gradually modify and tinker with the logic until you get the kind of behaiour you want- think quite hard about what the objective of the bots is - e.g. keep moving covering ground and not hitting anything, perhaps chossing a direction based on where they have not been before?.

    Sunday, December 6, 2015 5:55 PM
    Moderator
  • Thanks! I think that clears things up!

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, December 7, 2015 6:19 PM
    Answerer