I’m trying to convert this code to Javascript:
using UnityEngine;
using System.Collections;
using System.IO.Ports;
public class serialRotation : MonoBehaviour
{
SerialPort stream = new SerialPort("COM3", 57600);
void Start()
{
stream.Open(); //Open the Serial Stream.
}
// Update is called once per frame
void Update()
{
string value = stream.ReadLine(); //Read the information
float memeValue;
// attempt to parse the value using the TryParse functionality of the integer type
float.TryParse(value, out memeValue);
// print(memeValue);
Vector3 temp = transform.position;
temp.x = 0;
temp.y = memeValue /100;
temp.z = 0;
transform.position = temp;
}
}
I’ve tried many many times and always got compiling errors.
Anyone could help me please