Tag Archives: unity3d

Common issues with circular coordinates

For a tube simulation I am doing I am working with circular coordinates. I.e. a point on the wall of the tube could be defined by two parameters: the point along the centerline (spline) of the tube, and the angular coordinate given in the range [0,1].

Because the angular coordinate 1 describes a full rotation, 1 = 0; (because 360 degrees will give the same result as 0 degrees rotation)

This leads to a couple of issues if we want to calculate the difference between two angular coordinates, or the mean between two angular coordinates.

Continue reading

Selecting GameObjects with a generic ComboBox in Unity3d

objectComboBox

Unity’s GUI System does not offer a Combo Box at the time of writing and I needed a ComboBox to select different objects of a certain MonoBehaviour type in my simulation. Based on the ComboBox from here (there are a number of variations) I came up with my quick’n’dirty ObjectComboBox.cs script. It is a generic class that takes any kind of UnityEngine.Object (or an extension of Object) as a type parameter. That means any MonoBehaviour, Transform, GameObject, Vector3, you name it.

Continue reading

Screenshot Coroutine Demo

Waiting for Simulation Results using Coroutines in Unity3d

In an algorithm that I am implementing for my thesis, I need to wait for information from the simulation before I can continue the algorithm. In a multi-threaded application you could just create multiple threads with chunks of work that have to wait until other work is finished. But without multithreading there is a problem: How do you wait for something without blocking the entire Application while still tracking the state of an algorithm? Continue reading