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
  Connections Between Opposing Splines lockiidraws 1 596 12-04-2025, 02:14 PM
Last Post: _Aka_
  Spawn at start/ end of splines rickgplus 4 2,888 03-21-2025, 12:34 PM
Last Post: _Aka_
  Any performance 'hacks' for scene with lots of splines rickgplus 1 1,825 03-18-2025, 10:11 PM
Last Post: _Aka_
Smile Simple splines movement shills 3 3,236 02-26-2025, 09:40 AM
Last Post: _Aka_

Forum Jump: