1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.32 Bug Reporting thread
    Solutions and more information may already be available.

Collision Avoidance System

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by jackh4x, Apr 19, 2017.

  1. jackh4x

    jackh4x
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    249
    Hello everyone! I've been thinking about creating a collision avoidance system for Beam.NG. I saw in the devblog for 0.9 the following: "Simple AI crash detection. AI detects a crash and engages in maneuvers to get out of it." This is for the AI, not someone that's freeroaming. I imagine it can't be that hard. Here's a few ideas on how I'd go about this:

    1. Create an invisible cone with the top fixed on the rear view mirror and the base pointed out in front of the car. This would look like the selected headlights on a car in the map editor. If another vehicle passes into this cone, the car would measure the distance and rate of speed to apply the appropriate amount of braking power.
    2. This idea builds off of number one, where I could have an invisible plane mounted on the front bumper, waiting to detect another vehicle.

    If I were to go about this, I'd probably take some code from the postcrashbrake controller because that has the code that applies the brakes until the vehicle is stopped. The hard part would be the detecting another vehicle in front of you idea.

    Any advice on where to start or how to make this easier is greatly appreciated.
     
    • Like Like x 3
    • Agree Agree x 1
  2. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,710
    Are triggers a thing yet? Back in RoR we used to have beams that were called triggers. When you compressed them beyond a particular length they would "Trigger" a command key (could be any key on the keyboard pretty much). Back then I made an invisible really light bumper with these triggers and when I pressed it to far against something it would hit the brakes... really crude, but it did work... Ironically though there was no way to disable this so once you stopped... you stopped :D

    My best bet for Beam would be that you would have to do something similar but with LUA... not sure how one would accomplish this though.
     
  3. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    How AI avoids collisions? Why not have AI run in a background and grant control of brakes for AI when collision detection of AI triggers?
     
  4. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    • Informative Informative x 2
    • Like Like x 1
  5. jackh4x

    jackh4x
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    249
    Bless you, thanks!
     
  6. jackh4x

    jackh4x
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    249
    I played around with the feature they mentioned where the AI avoids accidents. It doesn't stop if there's something in front of it. The car attempts to maintain control if it gets in an accident. For example, I clipped the tail of the D15, it corrected the fishtailing, and applied the brakes.
     
    • Informative Informative x 1
  7. stenyak

    stenyak
    Expand Collapse
    Programmer & Global Moderator
    BeamNG Team

    Joined:
    Aug 6, 2012
    Messages:
    1,900
    Eh, ray casting unfortunately does not check against vehicle meshes, only against the map (going through some vegetation and similar soft-ish stuff, and stopping at more solid objects).

    This was added to implement the logic of the new External camera, to locate good cameraman spawn points where the car will hopefully be visible for the future duration of the shot. So it is not usable for dynamic collision avoidance.
     
    • Informative Informative x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice