Tag Info

Hot answers tagged

3

The reason you wouldn't put the initialize logic in the constructor is because Initialize is the first point where you can be sure that GraphicsDevice is set up. Recall that, while your constructor for your Game-derived class may create GraphicsDeviceManager, the graphics device itself is only created when Game.Run() is called (an instance method, so it ...


2

Disclaimer: this is not the academic approach to reduce complexity but it will work in this case. Build a 3d uniform grid or an Octree (depending on data distribution) of Edge arrays around the scene. Add each edge to the appropriate slot (based on the edge's center) in the grid / Octree. If the edge's center is epsilon away from the inner border of the ...


2

In Unity you can load any text file with Resources.Load() like this: string text = (Resources.Load("NameOfTextAsset") as TextAsset).text; After that you can use any standard C# method to split the string to parts, and Convert.ToInt32() to parse the integer from the splitted up string. foreach(string part in text.Split(' ')) { int number = ...


1

This is an interesting problem. I can think of two mechanical (brute-force-ish) approximate approaches. My math-fu is not strong enough to opine if an analytic solution is practical here. I hope there is such an approach! But here’s my “just get it done” suggestions. By Gridded Area, approximate We only care about the blue area. Represent that to the ...


1

Trigger an event, or just call the change method when you change the type of terrain object. Pull you color switching code out of start and put it in its own method. Then, have start call the SetColor method, and have your code that switches terrain types also call SetColor whenever the type changes. It's not something that needs to be done every frame, ...


1

Here is my implementation of Zehelvion's suggestion. An octree wasn't necessary but his suggestion helped to formulate the following method: private static int[] GenerateAdjacency(Vector3[] positions, List<int> positionIndices) { // faces within mesh int ncFaces = positionIndices.Count / 3; // vertex count ...


1

Try adjusting the Max Angular Velocity in the Physics Manager. You can access the Physics Manager by selecting Edit->Project Settings->Physics from the menu bar. The default value is 7. Maybe try a value around 100. That seemed to work well for me. You can override the Project Settings value of Max Angular Velocity for any Rigidbody by scripting ...



Only top voted, non community-wiki answers of a minimum length are eligible