Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle collision cannot be disabled #205

Open
BlackStar7713 opened this issue Feb 22, 2023 · 2 comments
Open

Vehicle collision cannot be disabled #205

BlackStar7713 opened this issue Feb 22, 2023 · 2 comments

Comments

@BlackStar7713
Copy link

Hello,
I'm trying to disable collision between vehicles via beamngpy.

In BeamNG the setting is Options->Gameplay->Simplified collision physics.
When changing this setting, the settings.json file in the user folder gets the new line ""disableDynamicCollision":"true""

Using the settings.change("disableDynamicCollision", "true") method works, as long as the disableDynamicCollision value is not already in the settings.json file.
If the value exists and is set to false, the method changes the setting in the json file, but in game the collisions are still enabled
(On further testing, this is not the deciding factor wether it works or not, as just now it failed to apply the settings even after deleting the line before starting)

In the in game settings menu, the simplified physics option is not selected, it does however show the warning below the setting, that normally only shows up when the setting is enabled.

This is my testing script, it has so far always reproduced the error on the second launch:

import time
from beamngpy import BeamNGpy, Scenario, Vehicle

bng = BeamNGpy('localhost', 64256, home='C:/Users/cryst/Documents/beamng/tech', user='C:/Users/cryst/Documents/beamng/user')
bng.open()
scenario = Scenario('smallgrid', 'example')
vehicle = Vehicle('ego_vehicle', model='etk800', license='PYTHON')
scenario.add_vehicle(vehicle, pos=(190, 0, 0), cling=True)
vehicle2 = Vehicle('vehicle2', model='etk800', license='PYTHON2')
scenario.add_vehicle(vehicle2, pos=(180, 0, 0), cling=True)

scenario.make(bng)
bng.settings.change("disableDynamicCollision", "false")
bng.scenario.load(scenario)
bng.scenario.start()
time.sleep(5)
bng.close()

time.sleep(5)

bng.open()
scenario = Scenario('smallgrid', 'example')
vehicle = Vehicle('ego_vehicle', model='etk800', license='PYTHON')
scenario.add_vehicle(vehicle, pos=(190, 0, 0), cling=True)
vehicle2 = Vehicle('vehicle2', model='etk800', license='PYTHON2')
scenario.add_vehicle(vehicle2, pos=(180, 0, 0), cling=True)

scenario.make(bng)
bng.settings.change("disableDynamicCollision", "true")
bng.scenario.load(scenario)
bng.scenario.start()
@aivora-beamng
Copy link
Contributor

aivora-beamng commented Feb 22, 2023

Hi, I will check the problem with settings, but in the meantime, you should be able to do this to enable/disable dynamic collision during runtime:

bng.control.queue_lua_command('be:setDynamicCollisionEnabled(false)')

Does it work for you?

@BlackStar7713
Copy link
Author

Hi,
Unfortunately replacing the previous commands with the lua command did not disable collisions either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants