- Home /
Real-time data visualization in Unity. Possible?
Hi there,
I am new to Unity and I am looking for a solution to visualize data (XYZ coordinates) in Unity in runtime.
Basically, we have a remote sensing network that can track the location of objects and out put the data. I want to visualize this data in Unity in real-time. Its like reconstructing the movement of the tracked objects in Unity simultaneously.
Does anyone know is Unity capable to do something like this? or any experience in similar process?
Many thanks in advance.
Transfer the location data using network sockets to a program that displays them using the Unity engine.
Hi, what was result of your try on unity? did you find a way to visualize timed positions wrote in file with unity ?
Hi,
How did you get on with using an external data source to drive the positions of the GameObjects?
I have a text file full of X,Y,Z coordinates that i'd like to read and change the position of a GameObject. Did you manage to achieve such a thing.
Thanks.
@rorybowcott On the face of it, that's not a difficult thing to do at all. But it does have a few elements to it, and your situation is slightly different (the networking aspect of this question is I$$anonymous$$O the most complex part of it, but you're working with a text file).
So, I would recommend posting a new question describing your situation in more detail, together with what you've tried and which aspect(s) of it you're having trouble with (eg reading the data from the file, setting the GameObject's positions, etc).
Answer by Sisso · Apr 07, 2014 at 05:22 PM
Think unity3d as a library. You can do whatever you want and integrate with any library. With Unity Free you could not directly access native (compiled dll for a driver, for example), but with c# you can do whatever you want, like use rest or sockets to connect in a server with the realtime data.
Thank you Sisso for the prompt reply.
I will be using Unity Pro for my project. Could you please explain a little bit more about accessing native or using rest or sockets? Have you even seen any examples similar to my application?
Excuse me if my questions sound silly. I am really new to this area.
Thank you :)
The problem is that it really depends how do you will provide your data, once you have your data, it simple fact of update your scene.
Some crazy examples and see if I hit what you need:
a) By native plugin
If you alread have a driver (like a 3d position hardware), you can integrate its dll using unit3d native plugin. http://docs.unity3d.com/Documentation/$$anonymous$$anual/Plugins.html
[DllImport ("__Internal")]
private static extern float[] GetTrackerPosition();
void Update() {
var pos = GetTrackerPosition();
transform.position = new Vector3(pos[0], pos[1], pos[2]);
}
b) local file
You could have some script that collect its data and write into a file.
import System.IO;
void Update() {
using (StreamReader r = new StreamReader("/tmp/lastPosition")) {
var text = r.ReadToEnd();
var pos = text.Split("\t");
transform.position = new Vector3(float.parse(pos[0]), float.parse(pos[1]), float.parse(pos[2]));
}
}
c) Request into a web
https://docs.unity3d.com/Documentation/ScriptReference/WWW.html
d) Sockets
http://stackoverflow.com/questions/17719541/writing-and-reading-using-socket-in-unity-3d
And it could go on....
Answer by gaminggal39 · Jan 13 at 11:52 AM
Please see this tutorial : https://www.youtube.com/watch?v=QrsBwc6HesU Easy method to create 3D graph
Your answer
Follow this Question
Related Questions
Is Unity3D capable of handling a MMo 3 Answers
desktop and mobile pairing 0 Answers
Variable not changing on real-time problem 2 Answers
multi Coloured Audio Waveform? 1 Answer
How do I make one object appear when I mouse over another object? 1 Answer