Форум

I have met a problem when using replicated objects in pedestrian library. I have created a pedArea objects with its Replication field set to 3 and following code will be executed in experiment startup to set relevant areaShape for each of the 3 pedArea: pedArea.get(0).areaShape = r1; //r1,r2,r3 are relevant areaShape for the 3 pedArea pedArea.get(1).areaShape = r2; pedArea.get(2).areaShape = r3; ShapeRectangle temp = (ShapeRectangle)pedArea.get(1).areaShape; temp.setFillColor(red); temp = (ShapeRectangle)pedArea.get(0).areaShape; temp.setFillColor(green); when running the experiment, it is observed that the fill color of each area is correct. But only the last pedArea(pedArea.get(2)) is activated. (i.e. its onEnter and onExit event will be triggered, can be used to detect the ped size & ped density inside the area) And the pedArea(0) and pedArea(1) are just idle, they will not repond to onEnter and onExit event and the ped size of these 2 area are always 0 even though many peds do inside the areas. Pls help me on this. btw: i got another question which is, is it possible that set the dynamic parameter of objects programmable? and if possible, how can i do that?
Hi Terry, Because of initialization order, the properties of the library blocks should be set before the startup code is executed. So I recommend you to store all area shapes in an array called "areaShapes" and then specify it in general properties of the replicated "Ped Area" object. The model will work fine in this case. As for parameters, yes it is possible to call "set_paramName()" methods to set the required values for parameters.

Ваше сообщение