UDP command logic
This commit is contained in:
41
README.md
41
README.md
@ -13,7 +13,7 @@
|
||||
|
||||
#### Key Scripts
|
||||
- **`TaskTimer.cs`** - Configurable countdown timer with UI display, color warnings when time is low, and auto-return to Lobby on expiration
|
||||
- **`TaskButtonManager.cs`** - Scene navigation using number keys (1-8 for tasks, L/0 for Lobby)
|
||||
- **`TaskButtonManager.cs`** - Scene navigation using number keys (1-8 for tasks, L/0 for Lobby) and UDP remote control (default port 5555)
|
||||
- **`PositionTracker.cs`** - Records Transform positions to CSV at configurable intervals for data collection
|
||||
|
||||
#### Technologies
|
||||
@ -46,6 +46,45 @@
|
||||
- **L or 0** - Return to Lobby
|
||||
- VR controllers for interaction within tasks
|
||||
|
||||
#### UDP Remote Control
|
||||
The Unity application listens for UDP commands on **port 5555** (configurable in Unity Inspector) for remote scene switching.
|
||||
|
||||
**Command Format:**
|
||||
```
|
||||
SWITCH:SceneName
|
||||
```
|
||||
|
||||
**Example Commands:**
|
||||
```bash
|
||||
# Switch to VR Task 1
|
||||
echo "SWITCH:VR-Task1" | nc -u localhost 5555
|
||||
|
||||
# Switch to AR Task 2
|
||||
echo "SWITCH:AR-Task2" | nc -u localhost 5555
|
||||
|
||||
# Return to Lobby
|
||||
echo "SWITCH:Lobby" | nc -u localhost 5555
|
||||
```
|
||||
|
||||
**Python Example:**
|
||||
```python
|
||||
import socket
|
||||
|
||||
def switch_scene(scene_name, host='localhost', port=5555):
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
message = f"SWITCH:{scene_name}"
|
||||
sock.sendto(message.encode('utf-8'), (host, port))
|
||||
sock.close()
|
||||
|
||||
# Usage
|
||||
switch_scene("VR-Task1")
|
||||
```
|
||||
|
||||
**Available Scene Names:**
|
||||
- `VR-Task1`, `VR -Task2`, `VR -Task3`, `VR -Task4`
|
||||
- `AR-Task1`, `AR-Task2`, `AR-Task3`, `AR-Task4`
|
||||
- `Lobby`
|
||||
|
||||
---
|
||||
|
||||
### Chat Application (`Chat-App/`)
|
||||
|
||||
Reference in New Issue
Block a user