This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine 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
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

VrpnTrackerDevice Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
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.

A class for the VRPN Plugin that allows receiving data about position, orientation, velocity and acceleration of tracked objects from 3D tracking sensors.

See Also#

  • Article on VRPN Plugin
  • A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/plugins/ folder:
    • vrpn_client_00
    • vrpn_client_01

VrpnTrackerDevice Class

Members


void setAccelerationCallback ( string name ) #

Sets the world script callback function that receives data about acceleration of tracked objects.

Arguments

  • string name - Callback function name.

Examples

Source code (UnigineScript)
VrpnTrackerDevice vrpn_tracker;

int init() {
	vrpn_tracker = new VrpnTrackerDevice("device_name@server_addr");
	vrpn_tracker.setAccelerationCallback("acceleration_callback");
	
	return 1;
}

int shutdown() {
	delete vrpn_tracker;
	return 1;
}

int update() {
	vrpn_tracker.update();
	return 1;
}
// a callback function
void acceleration_callback(int sensor,vec3 acceleration,quat orientation,float ifps) {
	log.message("Device sensor %d: acceleration %s, orientation %s, ifps %f\n",sensor,acceleration,orientation,ifps);
}

string getAccelerationCallback ( ) #

Returns a name of the world script callback function that receives data about acceleration of tracked objects. The callback function should be defined in the world script and receive 4 arguments:
  1. Sensor number (int)
  2. Linear acceleration (vec3 for the float precision version, or dvec3 for the double precision version)
  3. Acceleration of orientation change (an analog of angular acceleration; quat)
  4. Acceleration measurement time (float for the float precision version, or double for the double precision version)
Source code (UnigineScript)
// float precision
void callback_func(int sensor,vec3 acceleration,quat acceleration_orientation,float ifps) {
	// function logic
}
// double precision
void callback_func(int sensor,dvec3 acceleration,quat acceleration_orientation,double ifps) {
	// function logic
}

Return value

Callback function name.

void setTransformCallback ( string name ) #

Sets the world script callback function that receives data about position and orientation of tracked objects.

Arguments

  • string name - Callback function name.

Examples

Source code (UnigineScript)
VrpnTrackerDevice vrpn_tracker;

int init() {
	vrpn_tracker = new VrpnTrackerDevice("device_name@server_addr");
	vrpn_tracker.setTransformCallback("transform_callback");

	return 1;
}

int shutdown() {
	delete vrpn_tracker;
	return 1;
}

int update() {
	vrpn_tracker.update();
	return 1;
}
// a callback function
void transform_callback(int sensor,vec3 position,quat orientation) {
	log.message("Device sensor %d: position %s, orientation %s\n",sensor,position,orientation);
}

string getTransformCallback ( ) #

Returns a name of the world script callback function that receives data about position and orientation of tracked objects. The callback function should be defined in the world script and receive 3 arguments:
  1. Sensor number (int)
  2. Position (vec3 for the float precision version, or dvec3 for the double precision version)
  3. Orientation (quat)
Source code (UnigineScript)
// float precision
void callback_func(int sensor,vec3 acceleration,quat acceleration_orientation,float ifps) {
	// function logic
}
// double precision
void callback_func(int sensor,dvec3 acceleration,quat acceleration_orientation,double ifps) {
	// function logic
}

Return value

Callback function name.

void setVelocityCallback ( string name ) #

Sets the world script callback function that receives data about velocity of tracked objects.

Arguments

  • string name - Callback function name.

Examples

Source code (UnigineScript)
VrpnTrackerDevice vrpn_tracker;

int init() {
	vrpn_tracker = new VrpnTrackerDevice("device_name@server_addr");
	vrpn_tracker.setVelocityCallback("velocity_callback");
	
	return 1;
}

int shutdown() {
	delete vrpn_tracker;
	return 1;
}

int update() {
	vrpn_tracker.update();
	return 1;
}

// a callback function
void velocity_callback(int sensor,vec3 velocity,quat orientation,float velocity_ifps) {
	log.message("Device sensor %d: velocity %s, orientation %s, ifps %f\n",sensor,velocity,orientation,ifps);
}

string getVelocityCallback ( ) #

Returns a name of the world script callback function that receives data about velocity of tracked objects. The callback function should be defined in the world script and receive 4 arguments:
  1. Sensor number (int)
  2. Linear velocity (vec3 for the float precision version, or dvec3 for the double precision version)
  3. Velocity of orientation change (an analog of angular velocity; quat)
  4. Velocity measurement time (float for the float precision version, or double for the double precision version)
Source code (UnigineScript)
// float precision
void callback_func(int sensor,vec3 velocity,quat velocity_orientation,float ifps) {
	// function logic
}
// double precision
void callback_func(int sensor,dvec3 velocity,quat velocity_orientation,double ifps) {
	// function logic
}

Return value

Callback function name.

void update ( ) #

Updates the internal state of the device and receives input data.
Notice
This function should be called each frame.

VrpnTrackerDevice ( string name ) #

Constructor.

Arguments

  • string name - Path to the device in the format device_name@server_address.
Last update: 2021-12-13
Build: ()