Skip to content

Commit 71a27cd

Browse files
committed
Major refactor as a custom package
1 parent b62350f commit 71a27cd

55 files changed

Lines changed: 2968 additions & 3389 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Editor/TimeSyncEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using UnityEngine;
22
using UnityEditor;
33
using System.Collections;
4-
using LSL4Unity.Scripts;
4+
using LSL4Unity.Utils;
55

66

77
namespace LSL4Unity.EditorExtensions
88
{
9-
[CustomEditor(typeof(LSLTimeSync))]
9+
[CustomEditor(typeof(TimeSync))]
1010
public class TimeSyncEditor : Editor
1111
{
1212
public override void OnInspectorGUI()

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,47 @@ Open the Package Manager Window, click on the `+` dropdown, and [choose `Add pac
2222

2323
### Option 2 - Modify Project Package Manifest
2424

25+
This option is preferred if this package will be a dependency of another package.
26+
2527
Edit `<your project folder>/Packages/manifest.json` and [add the following to your dependencies section](https://docs.unity3d.com/2020.3/Documentation/Manual/upm-git.html):
2628

2729
`"com.LSL.LSL4Unity": "https://github.com/labstreaminglayer/LSL4Unity.git"`
2830

29-
The advantage of this approach is that it will allow you to specify this package as a dependency of another package.
30-
3131
### (Future) Option 3 - Using OpenUPM
3232

3333
TODO - https://openupm.com/docs/
3434

3535
## Using LSL4Unity
3636

37-
The easiest way is to use the Package Manager window, select the LSL4Unity package, and choose to install one or more Samples. Inspect the Samples to learn more.
37+
The easiest way is to use the Package Manager window, select the LSL4Unity package, and choose to Import one or more of the Samples.
38+
39+
The samples appear in `Assets/labstreaminglayer for Unity/1.16.0/{sample name}`. Open the sample's scene.
40+
41+
### Simple Inlet Scale Object
42+
43+
This scene uses LSL.cs only, and not any of the Utilitis or helpers that come with LSL4Unity. Thus it demonstrates the minimum required steps to resolve, open, and pull data from an LSL Inlet in Unity.
44+
45+
You will need a separate process running an LSL outlet with at least 3 float channels. In an active Python environment with [`pylsl`](https://github.com/labstreaminglayer/liblsl-Python) installed, run `python -m pylsl.examples.SendDataAdvanced`.
46+
47+
The cylinder will update its scale according to the data coming in from the found stream.
48+
49+
### Simple Physics Event Outlet
50+
51+
This scene uses LSL.cs only, and shows the minimal amount of code to setup a Markers stream and send events.
52+
53+
A sphere oscillates back and forth. Whenever it enters or exits the collider of a nearby cube, an event is transmitted.
54+
55+
Note that this sample is designed to send out physics events (collisions) and thus the events are timestamped when the collision is detected in code.
56+
57+
If you wanted to instead timestamp stimulus events then it would be better to send out the Marker on `WaitForEndOfFrame`. There is an example of this in the Complex Sample scene.
58+
59+
### Complex Outlet Inlet Event
60+
61+
A capsule continuously streams its pose over an outlet. Occassionally (every 2 seconds by default), the position is reset and new velocities are applied to the capsule.
62+
63+
A cube has its pose set (+ a static offset) by the values coming in from an inlet, the very same stream that the capsule is sending out.
64+
65+
Thus the cube should move the same as the capsule, except delayed by the capsule outlet -> cube inlet LSL transmission.
66+
67+
A plane changes its colours occassionally (every ~3.4 seconds). The colour change events also stream out a marker string of the new colour.
68+
The marker is sent out using WaitForEndOfFrame, so its timestamp should be as close as possible to the actual colour change on-screen.

0 commit comments

Comments
 (0)