Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
splines from .txt files
#7
Thank you, good to know about 1.61 and the related bugs. Does this mean a new version is coming out soon?

I have slightly changed directions again. I am a beginner at code, so the learning curve is a bit steep.

This works to read and put the data into strings:

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

[font]using UnityEngine;
using System.Collections;

public class readTXT : MonoBehaviour {

    public TextAsset track;

    void Start()    
    {       

        string[] dataLines = track.text.Split('\n');
        string[][] dataPoints = new string[dataLines.Length][];
        
        int lineNum = 0;
        foreach (string line in dataLines)
        {
            dataPoints[lineNum++] = line.Split(' ');
        }

        //DEBUGGING: (it works)
        //Debug.Log(track.text); //print document
        //Debug.Log(dataPoints[2][1]);  // prints 10.65696526
        //Debug.Log(dataLines[5]); // prints -27.31221962 11.09237289 76.1122818






    } 

}

And this works just to reference this script and make a button:

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV


using UnityEngine;
using UnityEditor;
using System.Collections;


[CustomEditortypeofreadTXT ) )]
public class Read : Editor
    
{
    
    public override void OnInspectorGUI()
        
    {
        
        base.OnInspectorGUI ();
        
        EditorGUILayout.LabelField ( "Spine Reader" );
        
        
        ifGUILayout.Button ( "READ!"))
        {
            Debug.Log"pressed read" );

            
        }
    }
    
}    

But as far as getting it to read the file into a spline, I am not sure. When I try I get errors for trying to access a non static variable. But really, I am not sure how to address curvy. Should I make an array of vector3? Or a for / foreach look to cycle through the document and instantiate a control point?

I looked at the information on SplineShaper and CurvyShape, but I am afraid as a beginner I wasn't able to glean much from them.
Does this mean CurvySpline.Add() is not the right way to make a control point?
[/font]
 
Reply


Messages In This Thread
splines from .txt files - by Lila - 04-30-2014, 01:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Unity Splines _Aka_ 5 19 04-25-2024, 11:11 AM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 15 02-26-2024, 09:49 AM
Last Post: _Aka_

Forum Jump: