Welcome to Realtime Technologies Support Forum


  Reply to this topicStart new topicStart Poll

> How do I set the ambient traffic density?
hstoner
  Posted: Feb 13 2007, 02:18 PM
Quote Post


SimVista Forum Moderator
***

Group: Members
Posts: 65
Member No.: 16
Joined: 5-September 06



There are many ways you can define the ambient traffic density within the scenario. The easiest way is to place a proximity sensor within the world and define the onInitialize function. Remember that any onInitialize function within a proximity sensor is executed prior to the simulation starting.

this.onInitialize = function() {
Scenario.setAmbientTrafficDensity(0.0);
}

For more detail on the setAmbientTrafficDensity and getAmbientTrafficDensity see the index in the SimVista manual.
PMEmail Poster
Top
hstoner
Posted: Mar 12 2008, 08:35 AM
Quote Post


SimVista Forum Moderator
***

Group: Members
Posts: 65
Member No.: 16
Joined: 5-September 06



The setAmbientTrafficDensity was really only designed to change the level of traffic density and not eliminate it. Please refer to your SimVista manual on how traffic is created/destroyed using this function.

If you want to eliminate traffic from being created but still have the ability to script vehicles here is a solution.

The solution is to place all the traffic at a location so it can not be used in the simulation as ambient traffic. You may remember from training that the moving models component has all the available vehicle that can be used within scripts and that will be available as ambient traffic. Essentially what we are going to do is "script" them so they can't be part of ambient traffic, but you could then script them later.

In your database place a marker in the scenario and call it holding. You can name it anything, but you would need to adjust the code. After you have this in the scenario you need to add some code to part of an onInitialize function.


CODE

this.onInitialize = function () {
             
   myVehicleArray = new Array();

//loop though all the vehicles in the model (there are 52 of them in SMACSimCivilian) and place them at marker named "Holding"
  for (var i = 0; i < 52; i++)
 {
   myVehicleArray[i] = Scenario["Vehicle" +i];
   print("My array value " + myVehicleArray[i]);
  }
}

PMEmail Poster
Top

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0459 ]   [ 10 queries used ]   [ GZIP Enabled ]