Skip to content

Tutorial ‐ Step 2

ptaillandier edited this page Jan 24, 2024 · 23 revisions

Creation of the Unity basic game

Creation and setting of the project

  • Create a new project using the VR model
  • Install the GAMA_UNITY_VR package: download the file here, Menu "Assets" -> "Import Package" -> "Custom Package...", then select the file and import all elements from it. The package includes 3 important scenes (Assets/Scenes folder): The "Start Up" menu, which is the scene launched at the start of the game; the "IP Menu", which lets you configure the IP of the computer running GAMA or the middleware; and the "Main Scene" in the Demo folder. In this tutorial, we will only modify the latter scene.

Player agent settings

By default, the “Main Scene” includes an FPS player. This type of player is subject to gravity and moves at ground level, considering geometries with a collider as obstacles. In our case, we prefer to have a “decision maker” view from the sky. We will remove the FPS player (right-click it and then delete). In Prefabs, GAMA Link, Player, drag and drop the "GodViewPlayer" into the scene.

Game manager settings

In the main scene, inspect the “Game Manager” in “Managers”. In the Simulation Manager, drag and drop the GodViewPlayer game object from the Main Scene to "Player". Then, as we only have one type of agent that we send to Unity ("people" agents), we will only keep one element in the "Agents", "Rotations", "Rotations coefficient", "Y Values" and "Size Factor" lists. These lists respectively represent the prefab used to represent the agents to send (in our case, the "people" agents), the rotation to apply to this prefab (according to the Y axis), the rotation coefficient to apply to it (according to the Y axis), the offset to apply along the Y axis and the size scale of the prefab. In this tutorial, we will define them respectively as for the list of agents, the "CAR" prefab (found in Assets/Prefabs/Visual Prefabs/City/Vehicles/), for Rotations, 90, for the Rotation Coefficient, - 1, for the Y value, 0.5, and 0.4, for the size factor.

Clone this wiki locally