I have an array of objects that I've set in random positions. Vizard has this proximity sensor/target feature which I've used to assign a sensor to each car and also made each car a target. However, when I create an action for each sensor/target interaction, all of the cars react in the same way (this is expected since I've made each car be its own sensor AND target).
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.
Any ideas?