View Single Post
Old 08-26-2018, 03:58 PM
hannahapz hannahapz is offline
Join Date: Apr 2018
Posts: 22
Here is the code AFTER I've created a list of positions. Here I create an array of 3D cars:

obs_cars_array = []
for c_set in obs_pos: # for every coordinate set in the list of positions
obs_car = viz.add('mini.osg') # assign a car avatar
obs_car.setPosition([c_set[0], 0.8, c_set[1]]) # set the position of each car avatar
obs_cars_total.append(obs_car) # create array of 3D car objects
Then I create a sensor and target within same block of code:

obs_car_target = vizproximity.Target(obs_car) # make each car a target
manager.addTarget(obs_car_target) # add it to the target manager
sensor = vizproximity.addBoundingSphereSensor(obs_car,scale =1) # make same car a sensor
manager.addSensor(sensor) # update sensor manager
I need to find a solution that will help me prevent any of the cars in the array from getting too close to another another.
Reply With Quote