suite à vos recommandations je suis passé de ITWEEN à DOTWEEN
J'essaie de modifier mon code en utilisant DOTWEEN mais j'ai des erreurs et je ne sais pas quelle variable utiliser pour remplacer "myPathWaypointsArray".
principe du code
Je connais le nombre d'index, l'écart entre eux, et en fonction de la vitesse affichée , on calcule le temps mis pour effectuer le path
code erreur sur 2 lignes ( normal , j'ai dupliqué la même)
"Assets/SCRIPT/Route/TrajetVl.cs(43 et 50 ,35): error CS1501: No overload for method `DOPath' takes `4' arguments"
Code : Tout sélectionner
using UnityEngine;
using System;
using System.Collections;
using DG.Tweening;
public class TrajetVl : MonoBehaviour {
//chemin à prendre
public GameObject target_Path;
//vitesse km/h
public float kmh;
//distance entre point
public float mEntrePoint = 5.0f;
private float time;
public float fraction;
private bool start;
private Transform[] tabt;
void Start () {
SetPath(target_Path);
}
void SetPath (GameObject pathObject) {
int id = 0;
tabt = new Transform[pathObject.transform.childCount];
foreach (Transform child in pathObject.transform) {
tabt[id++] = child.transform;
}
start = true;
}
void LateUpdate () {
//nombre de point * distance entre point / km/h / 3.6
time = (tabt.Length * mEntrePoint)/(kmh / 3.6f);
if (start) {
//transform.position = iTween.PointOnPath(tabt, fraction); // ligne ITWEN qui fonctionne
transform.DOPath(myPathWaypointsArray, time, PathType.CatmullRom).SetOptions(true).SetLookAt(0.0001f).SetLoops(-1);
fraction += Time.deltaTime / time;
if (fraction > 1.0f)
fraction = 0.0f;
//transform.LookAt(iTween.PointOnPath(tabt, fraction + 0.001f));// ligne ITWEN qui fonctionne
transform.DOPath(myPathWaypointsArray, time, PathType.CatmullRom).SetOptions(true).SetLookAt(0.0001f).SetLoops(-1);
}
}
}