Hi, I explain :
I just want to change the value Speed of the Motor of my AI.
My PatrolRoute works, I have the value that I send with my Arduino but I don’t know how to change the value speed according to the Arduino’s value.
I’m using an Arduino and i try this :
using RAIN.Action;
using RAIN.Motion;
using System.Collections;
using System.IO.Ports;
using UnityEngine;
public class WALLAH : MonoBehaviour {
private AIRig _aiRig = null;
SerialPort sp = new SerialPort("COM5",9600);
void Start () {
sp.Open ();
_aiRig = GetComponentInChildren<AIRig>();
}
void Update () {
if(sp.IsOpen)
{
try
{
MoveObject(sp.ReadByte());
print(sp.ReadByte());
}
catch(System.Exception)
{
}
}
}
void MoveObject(int vitesse)
{
_aiRig.AI.Motor.Speed = vitesse;
}
}
And the value doesn’t change.
Thank you for answers.