Let's see here how to use vsVIEWER from vsTASKER.
For each case, we will start from white page but the purpose is to understand the principle so that it can be applied to an existing database.
If you have version 7.0, you must move the following files to vsTASKER directories in order to connect to vsVIEWER.
Copy the two files from {vsVIEWER}/Data/vsTASKER/v7.0/Shared into {vsTASKER}/Data/Shared/vsVIEWER (create the last directory)
simple_lan.lan
viEntProxy.cpt
Copy the directory {vsVIEWER}/Data/vsTASKER/Db/test_vsviewer_lan into {vsTASKER}/Data/Db
After that, you can create the following example.
In vsTASKER, create a new database (or open empty database) and save it under my_vsviewer_lan
Make sure that the terrain dimensions is 1000x1000 meters or smaller.
Then, add a default entity on the map and give it any direction and a speed of 5 m/s.
Now, in , select and open Container Others.
Right click, , ... and in folder /Shared/vsVIEWER, select viEntProxy.cpt
Right click the imported component and give it to the default entity (created earlier).
Now select entity default on the map and click on the panel, then double click the vsEntProxy component.
Give the 3D model name, ie t72 (as it exists in the vsVIEWER database) to use to represent the entity default in the IG.
From now, the entity is capable of outputting itself to vsVIEWER. We need to make vsTASKER capable of talking to the IG using LAN protocol.
in , select , then right click and select . Press the button then in Shared/vsVIEWER folder, select simple_lan.lan
Open property window, select panel and make sure it includes vi_types.h (add it if missing).
#include "C:/VirtualSim/vsViewer/1/include/vi_types.h"
|
Now, for performance reasons, a vi_proxy pointer must be added in the Entity class. In , double click the item, then add in :
Then, in panel, add the following in the RESET section:
vi_proxy = findViEntProxy();
|
Now you can compile and run the simulation.
For the IG, open vsVIEWER GUI and open the default.vsv database. Make sure that protocol is enabled.
Select , default and make sure that the dimensions matches the one in vsTASKER (we just need a checker for the ground)
Start the IG.
You should see a checker with the t72 tank moving on it.
Press space key to focus the camera on the tank.
Now you can propagate the process to your actual databases. All you need is the LAN setting and to attach the viEntProxy to any entity which should be visible on vsVIEWER IG.
|
This example is available in test_vsviewer_lan database available in /Data/vsTASKER/Db
|