Hi, I don’t really understand why once I read the CSV files and write them into listX, listY and listZresult vectors, as can be seen in the attachment, if I try to take them inside a Vector3 structure Unity tells me that those vectros don’t exist. Can please someone help me? Thanks but I’m new to Unity and I find it quite complex
it says that no listX, Y and Zresult exists. But when I start it outside Unity, as I developed it, with Visual Studio, it works correctly since I added in that case a WriteLine to check the contents of the 3 vectors. Also if I use it outside Unity the 3 vectors have the same length
Ok I placed a debug to check if they exist or not and it seems that they exist. Now the (I hope) last problem is at the end, in fact I saved all the data as double but I think that Vector3 works with float, I tried to apply what I found on the web to convert it but it doesn’t work. Do you have any suggestion?
nice.
you could loop the values inside Update() method, increment index once a frame,
or using coroutine (which is kind of like a fake threading, that you can add delay into)
Hi, I tried with the Update() but it dowsn’t work. I uploaded the script I used, at first I recalled the variables inside the Start(), then instead, I recalled them inside Update(). With the start nothing happens and I also think that this is not the correct way. With the Update() it doesn’t work. I attached the errors given by Unity
its the scope issue again, those variables are declared inside Start() so they are not available outside it.
so move them to class level, outside the Start().
Hi, here I am again. I don’t really understand how to use the coroutine but before if I’m going to print the actual coordinates once each cycle, they seemes wrong, can you please try to make me understand why? Moreover, my aim is to simulate a 3d printer, do you also know how can I make the plastic filament deposited following the nozzle of the printer? (Until now I applied the script to a cube to understand if it works or not).
then start that coroutine after you have finished loading, end of Start(),
StartCoroutine(Animate());
then inside Animate() method,
loop your data one by one, with 1 frame delay
for(var i=0;i<listX.Count;i++)
{
// your code to get values for i, then move cube to that position
yield return 0; // wait 1 frame
}
for simulating 3d printed material generation,
i guess could search for something like: unity marching cubes
(basically its a 3d grid/, and changing cell value above 0 creates (iso)surface on that space…)
not sure if its good enough for 3d printer simulation though… but can try.
also initially you could test by spawning cubes on those positions, to see how it looks,
I tried what you said with the coroutine but there was an error (CS1001), so I searched on the web and I tried like I uploaded but now seems the coroutine doesn’t start. Do you know why?
Thanks for your patience but I really don’t understand
No, but if I neglect Move() and use only the StartCoroutine(Animate()); alone, it returns the CS1001 error, while if I add the Move() it doesn’t return errors but the cube doesn’t move