Tanoda
DobotRelativeController.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public class DobotRelativeController : MonoBehaviour
6{
8
9 void Update()
10 {
11#if !UNITY_WEBGL
12 if (Input.GetKey(KeyCode.Keypad8))
13 {
14 serial.SendRelativeMoveCommand(Vector3.forward);
15 }
16 if (Input.GetKey(KeyCode.Keypad2))
17 {
18 serial.SendRelativeMoveCommand(-Vector3.forward);
19 }
20 if (Input.GetKey(KeyCode.Keypad6))
21 {
22 serial.SendRelativeMoveCommand(Vector3.right);
23 }
24 if (Input.GetKey(KeyCode.Keypad4))
25 {
26 serial.SendRelativeMoveCommand(-Vector3.right);
27 }
28 if (Input.GetKey(KeyCode.Keypad9))
29 {
30 serial.SendRelativeMoveCommand(Vector3.up);
31 }
32 if (Input.GetKey(KeyCode.Keypad7))
33 {
34 serial.SendRelativeMoveCommand(-Vector3.up);
35 }
36#endif
37 }
38}
SerialControllerBytes serial