This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

VRPN Add-On

Virtual Reality Peripheral Network (VRPN)is a device-independent system for accessing virtual reality peripherals in VR applications. The VRPN system consists of programming interfaces for both the client application and the hardware drivers and a server application that communicates with the hardware devices. TheDTrackapplication often goes as a server application.

A Virtual Reality Peripheral Network (VRPN) plugin represents the client application which is connected to the server and used for receiving input data from different input devices (joysticks, 3D motion and orientation tracking sensors and so on) via the Network. The plugin is provided as an add-on.

For example, by using the VRPN plugin, you can implement an application that processes input data from ART controls.

See Also

  • VrpnAnalogDeviceclass
  • VrpnButtonDeviceclass
  • VrpnTackerDeviceclass
  • Samples on plugin usage:
    • data/samples/plugins/vrpn_client_00 that demonstrates receiving data from the FlyStick device and two sensors, tracking this device and a head. The data is presented as a text.
    • data/samples/plugins/vrpn_client_01 that demonstrates receiving data from the virtual FlyStick device and two sensors, tracking this device and a head, inside the UNIGINE scene.
    Notice
    The samples will be available if you add the VRPN plugin add-on to your project via UNIGINE SDK Browser.

Launching VRPN Plugin

Notice
Before launching the plugin, you should run a server application (it is usually DTrack) that receives input data from an input device. The VRPN plugin will connect to this server and receive data from it.

To use the VRPN plugin, you should perform the following:

  1. Install the VRPN plugin (available via UNIGINE SDK Browser in the Add-Ons section) and add it to your project (by clicking Configure Project -> Add-ons in the Projects section of UNIGINE SDK Browser).
  2. Specify the extern_plugin command line option on the application start-up:
    Shell commands
    main_x86 -extern_plugin "VrpnClient"

Implementing Application Using VRPN Plugin

When the VRPN plugin add-on is added and run, the following classes are added to UnigineScript:

  • VrpnAnalogDevicethat receives data about input devices sticks.
  • VrpnButtonDevicethat receives data about input devices buttons states.
  • VrpnTrackerDevicethat receives about position, orientation, velocity and acceleration of tracked objects from 3D tracking sensors.
Notice
Each class can be instanced more than once.

When implementing an application using the plugin, instances of the classes listed above should be created on engine initialization.

Notice
The server address and the device name should be passed to constructors of the UnigineScript classes (VrpnAnalogDevice, VrpnButtonDevice, VrpnTrackerDevice) as follows: device_name@server_address.

For example, if the VRPN server is set on the PC via the DTrack application, the following should be passed: DTrack@localhost. If the server is set on another PC, instead of the localhost, you should specify the PC's IP address. Also you should call the update()method for each initialized device on engine update.

Source code (UnigineScript)
#ifdef HAS_VRPN_CLIENT

VrpnTrackerDevice tracker;
VrpnButtonDevice button;
VrpnAnalogDevice analog;

int init() {
	
	tracker = new VrpnTrackerDevice("DTrack@localhost");
	button = new VrpnButtonDevice("DTrack@localhost");
	analog = new VrpnAnalogDevice("DTrack@localhost");
	
	return 1;
}

int shutdown() {

	delete tracker;
	delete button;
	delete analog;
	
	return 1;
}

int update() {
	
	tracker.update();
	button.update();
	analog.update();
	
	return 1;
}

#else

int init() {
	log.warning("No VRPN plugin detected\n");
	return 1;
}

int shutdown() {
	return 1;
}

#endif
Last update: 03.07.2017
Build: ()