This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
UnigineScript
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
Content Optimization
Materials
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

VRPN Client Plugin

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.

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. The DTrack application 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.

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

See Also#

  • VrpnAnalogDevice class
  • VrpnButtonDevice class
  • VrpnTackerDevice class
  • Samples on plugin usage:
    • <UnigineSDK>/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.
    • <UnigineSDK>/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 are available if you add the VRPN Client plugin to your project via UNIGINE SDK Browser.

Launching VRPN Client 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 Client plugin will connect to this server and receive data from it.

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

  1. Specify the extern_plugin command line option on the application start-up:
    Shell commands
    main_x64 -extern_plugin "VrpnClient"

Implementing Application Using VRPN Client Plugin#

When the VRPN Clieng plugin is loaded, the following classes are added to UnigineScript:

  • VrpnAnalogDevice that receives data about input devices sticks.
  • VrpnButtonDevice that receives data about input devices buttons states.
  • VrpnTrackerDevice that 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 Client plugin detected\n");
	return 1;
}

int shutdown() {
	return 1;
}

#endif
Last update: 2021-04-29
Build: ()