erreur de compilation dans l'unité lorsque je lance mon programme de jumeaux virtuel avec UNITY
Publié : 20 Oct 2022 10:56
Je tiens à préciser que je suis novice en développement...fichier c# contenant le code des jumeaux virtuels qui doit s'afficher sur unity quand je présente mon mans devant la web cam mais j'obtiens des erreurs sur unity quand je veux pour exécuter le code afin d'obtenir les jumeaux 3D BESOIN D'AIDE s'il vous plaît
voici la video youtube qui montre ce que je suis entrain de vouloir faire mais avec deux mais au lieu de deux comme sur la video
3D HAND TRACKING
errorr:
(1) ArgumentOutOfRangeException : l'index et le nombre doivent faire référence à un emplacement dans la chaîne. Nom du paramètre : count System.String.Remove (System.Int32 startIndex, System.Int32 count) (at <6073cf49ed704e958b8a66d540dea948>:0) HandTracking.Update () (at Assets/HandTracking.cs:20)
(2) IndexOutOfRangeException : l'index était en dehors des limites du tableau. HandTracking1.Update () (dans Assets/HandTracking1.cs:30)
le code UDP RECEIVE
ERROR:
(3) SocketException: Une seule utilisation de chaque adresse de socket (protocole/adresse réseau/port) est habituellement autorisée.
System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) (at <6d7c4c8dd3624dc596686fb7270ae1e6>:0)
System.Net.Sockets.UdpClient..ctor (System.Int32 port, System.Net.Sockets.AddressFamily family) (at <6d7c4c8dd3624dc596686fb7270ae1e6>:0)
System.Net.Sockets.UdpClient..ctor (System.Int32 port) (at <6d7c4c8dd3624dc596686fb7270ae1e6>:0)
UDPReceive.ReceiveData () (at Assets/UDPReceive.cs:33)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ThreadHelper.ThreadStart () (at <6073cf49ed704e958b8a66d540dea948>:0)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)
voici la video youtube qui montre ce que je suis entrain de vouloir faire mais avec deux mais au lieu de deux comme sur la video
3D HAND TRACKING
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HandTracking1 : MonoBehaviour
{
// Start is called before the first frame update
public UDPReceive udpReceive;
public GameObject[] HandPoints;
void Start()
{
}
// Update is called once per frame
void Update()
{
string data = udpReceive.data;
//data = data.Remove(0, 1);
//data = data.Remove(data.Length-1, 1);
//print(data);
string[] points = data.Split(',');
//print(points[0]);
for (int i = 21; i<42; i++)
{
float x = 8-float.Parse(points[i*3])/100;
float y = float.Parse(points[i*3 +1]) / 100;
float z = float.Parse(points[i*3 +2]) / 100;
//print(i);
HandPoints[i].transform.localPosition = new Vector3(x, y, z);
}
}
}
(1) ArgumentOutOfRangeException : l'index et le nombre doivent faire référence à un emplacement dans la chaîne. Nom du paramètre : count System.String.Remove (System.Int32 startIndex, System.Int32 count) (at <6073cf49ed704e958b8a66d540dea948>:0) HandTracking.Update () (at Assets/HandTracking.cs:20)
(2) IndexOutOfRangeException : l'index était en dehors des limites du tableau. HandTracking1.Update () (dans Assets/HandTracking1.cs:30)
le code UDP RECEIVE
Code : Tout sélectionner
using UnityEngine;
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class UDPReceive : MonoBehaviour
{
Thread receiveThread;
UdpClient client;
public int port = 5052;
public bool startRecieving = true;
public bool printToConsole = false;
public string data;
public void Start()
{
receiveThread = new Thread(
new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start();
}
// receive thread
private void ReceiveData()
{
client = new UdpClient(port);
while (startRecieving)
{
try
{
IPEndPoint anyIP = new IPEndPoint(IPAddress.Any, 0);
byte[] dataByte = client.Receive(ref anyIP);
data = Encoding.UTF8.GetString(dataByte);
if (printToConsole) { print(data); }
}
catch (Exception err)
{
print(err.ToString());
}
}
}
}
ERROR:
(3) SocketException: Une seule utilisation de chaque adresse de socket (protocole/adresse réseau/port) est habituellement autorisée.
System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) (at <6d7c4c8dd3624dc596686fb7270ae1e6>:0)
System.Net.Sockets.UdpClient..ctor (System.Int32 port, System.Net.Sockets.AddressFamily family) (at <6d7c4c8dd3624dc596686fb7270ae1e6>:0)
System.Net.Sockets.UdpClient..ctor (System.Int32 port) (at <6d7c4c8dd3624dc596686fb7270ae1e6>:0)
UDPReceive.ReceiveData () (at Assets/UDPReceive.cs:33)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.Threading.ThreadHelper.ThreadStart () (at <6073cf49ed704e958b8a66d540dea948>:0)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)