Beispiel #1
0
    public Vector3 GetPosOnTrack(float t)
    {
        curTrackTime = avaSecpersec * t - starttime;
        while (curTrackTime < 0)
        {
            curTrackTime += vehicleTrack.maxTrackTime;
        }
        while (curTrackTime > vehicleTrack.maxTrackTime)
        {
            curTrackTime -= vehicleTrack.maxTrackTime;
        }

        var(imin, imax, lamb) = sdf.InterpolateFloat("Elaptime", curTrackTime);
        //Debug.Log($"curTrackTime:{curTrackTime} imin:{imin} imax:{imax} lamb:{lamb}");
        var lat = sdf.DeInterploateDouble("y", imin, imax, lamb);
        var lng = sdf.DeInterploateDouble("x", imin, imax, lamb);
        var ll  = new LatLng(lat, lng);

        (var pos, _, _) = VehicleTrack.qmesh.GetWcMeshPosFromLatLng(ll);
        //Debug.Log("MoveAvaGo at time " + curtime + " ll:" + ll.ToString() + "  pos:" + pos);
        return(pos);
    }