Getting started
Unity client
Prerequisites
Unity 2019.04 LTS
First run
Open the UnityClient project by going to the project directory (by default %USERPROFILE%\Hadean\Aether Engine Examples\PhysicsDemo\UnityClient
) and double-clicking the main scene file, located in UnityClient\Assets\Scenes/physx-demo.unity
:
Once opened, the project should look like the screenshot below:
To test the client you need to be connected to Connect. There are two ways for the client to connect to Connect, through localhost
(127.0.0.1) or through the WSL container IP. To enable this connection for the Physics demo you need to go into %USERPROFILE%\Hadean\Aether Engine Examples\PhysicsDemo\UnityClient\Assets\Scripts
, open the GameSystem.cs
file and change the endpoint to the localhost. It should look like the screenshot below:
If the port Connect uses is already being used e.g. by Ubuntu WSL container then the WSL Nat bridge will connect to that container and not the simulation container. In these case we have the option to use the WSL container IP for the simulation (provided during run process) directly as an alternative.
To get the IP address (localhost
):
Start PowerShell
Run
ipconfig
Find the
Ethernet adapter vEthernet (Default Switch)
section in the outputCopy the value in the
IPv4 Address
section
The exact IP varies between machines and can change between restarts
After this modification you also need to have the simulation running in the background.
First build the simulation:
Once built, run the simulation:
The simulation does not start immediately. First you are given information about which is the Wsl container IP. To continue and start the simulation process you just click
enter
.
Once the simulation is running, click the play button in the Unity editor to start the client.
If the simulation isn't running while you start the client, an error will appear in the console view on the bottom left of the project window:
Otherwise, the client should connect successfully and show a couple of bouncing cubes:
Once connected the following controls are available:
Left mouse button spawns a cube in random location
W, A, S and D move the camera
Mouse rotates the camera
While in the Unity editor, a debug view can be enabled which displays the Aether simulation's cells. To enable the debug gizmos view select the Gizmos view in the menu on the top right of the editor view:
Configuring a Script Editor
The UnityClient projects contains multiple C# script files which are used to render the simulation. The Unity editor doesn't have built-in support for changing these files, but lets you configure an external editor. This guide recommends using Visual Studio Community 2019, as it has full and accurate IntelliSense support once configured.
To set up Visual Studio Community 2019 as the script editor:
Install Visual Studio Community 2019
In Visual Studio go to Tools -> Get Tools and Features -> Install "Game development with Unity" Workload.
In Unity go to Editor -> Preferences -> Change the External Script Editor to Visual Studio 2019 (Community). Make sure "Editor Attaching" is selected.
Double clicking on a C# file in Unity will now open Visual Studio with IntelliSense properly configured. To test this, open a script file in Unity for example
Assets/Scripts/GameSystem.cs
:
The opened project should look like the following. Notice that there are no errors about missing libraries or unknown references:
OpenGL client
For details on building and starting OpenGL client, look at our Getting Started section.
Once the client is started, the following controls are available:
left mouse button clicks will cause additional cubes to be spawned
mouse movement will rotate the camera position around the origin
mouse scrolling and the keys W and S will change the distance of the camera from the origin
the A and D keys will move the camera horizontally
the SPACE and left Ctrl keys will move the camera vertically
the Esc and Q keys will exit the client
Last updated