refactor work and documentation

This commit is contained in:
Hartmut Seichter 2025-07-08 09:45:49 +02:00
parent 46491f8e2f
commit 5b203c9531
4 changed files with 23 additions and 9 deletions

View file

@ -2,13 +2,13 @@
A native GDScript implementation of the [VRPN](https://vrpn.github.io/) client protocol.
# TOC
# Background
Various VR tools even today in use are providing an interface for tracking data by implementing a VPRN server. Binding a the actual VRPN library into an extension is proven and working but is quite a burden if the main aim of usage is receiving tracking data. Hence, this project was born to allow for easy integration of VRPN tracking in Godot.
VR hardware and software provide commonly an interface for tracking data by implementing a VPRN server. Binding the actual VRPN client library into an extension is proven and working poses a burden for maintenance and deployability. To solve this gdvrpn allows for a native integration of VRPN tracking in Godot.
This project does not implement any server components and is only tested with a limited number of devices in our lab.
This project does not implement any server components or forwarding and is only tested with a limited number of devices in our lab. Currently, UDP mode is under development.
![Tracking with an OptiTrack System](addons/docs/img/gdvrpn.jpg)
# Install
@ -16,7 +16,21 @@ Install the project from the AssetLib in Godot or directly from the repository.
# Usage
TBW
There are two components, a `VRPN_Client` and needed for using this addon:
`VPRPN_Client` is mandatory and implements the network component of this addon that parses the data received and broadcasts them to the respective receivers within the scene tree.
`VRPN_Tracker` is a receiver taking pose information (i.e. position and orientation) of a rigid body and applies it to the nodes global transform.
`VRPN_Button` is a receiver of button events.
## Example
For some inspiration try the example `spin_tracker.tscn`. To create a test input use the shipped VRPN config file `test/vrpn.test.cfg` as follows (from the root of this repository)
```bash
$> vrpn_server -f addons/vrpn/tests/vrpn.test.cfg
```
# License

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View file

@ -3,14 +3,14 @@ extends Node
@export var vrpn_client : VRPN_Client = null
@export var button_sensor : String = "Button0"
@export var register_on_start : bool = true
@export var register_on_ready : bool = true
var state : int = 0
func _ready():
if not vrpn_client:
push_warning("No VRPN client for button on '%s' given." % [self.name])
elif register_on_start:
elif register_on_ready:
vrpn_client.buttons.append(self)
func _on_vrpn(vrpn_data : Dictionary) -> void:

View file

@ -6,10 +6,10 @@ extends Node3D
@export var tracker_sensor : int = 0
@export var tracker_use_position : bool = true
@export var tracker_use_rotation : bool = true
@export var register_on_start : bool = true
@export var register_on_ready : bool = true
func _ready() -> void:
if vrpn_client and register_on_start:
if vrpn_client and register_on_ready:
vrpn_client.tracker.append(self)
func _on_vrpn(vrpn_data : Dictionary):