Tag Info

Hot answers tagged

4

I found I had to do the following to set the FPS limit free. In your Game class, do the following: graphics = new GraphicsDeviceManager(this); // I have this stored as a member variable graphics.SynchronizeWithVerticalRetrace = false; IsFixedTimeStep = false; Note that an unlimited FPS can cause unpredictability in physic engines, and network games. A ...


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

There's class named TextAssets which is used for text file read. http://docs.unity3d.com/Manual/class-TextAsset.html here you can find the supported file format. so if u want to read read the text file, script would be like this: class YourClassName : MonoBehaviour{ public TextAsset textFile; // drop your file here in inspector void Start(){ ...


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

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

To answer your question simply: Get list of all the RenderComponents, and a list of all the Movement Components. We assume each component has a field which gives the entity is is a part of. Sort them by entity ID. Obviously, if you keep these lists sorted in the systems themselves, then this is very inexpensive (maintaining the sorting is cheap). ...


1

You could store components two-dimensionally in a list of lists: List<List<PslComponent>> _componentsByType; You use the component type ID as the index into the outer list... List<PslComponent> componentByEntity = _componentsByType[componentTypeId]; ...and then use the entity ID to look up the component of that type on that entity (or ...


1

A health/damage mining system would be much more flexible and should be easier to implement than a fixed, time-based system. Basically, assign each block a health value, and your pickaxe a "mining damage" value, and whenever the pick strikes the block, you subtract its damage from the health of the block. When the block's health goes to zero or below, the ...


1

The FPS is capped at 60 because of the default value of true on Game.IsFixedTimeStep. If you set this value to false it should allow your FPS to go to whatever you need it to. Game.IsFixedTimeStep on MSDN


1

C# Version. using System.IO; void readTextFile(string file_path) { StreamReader inp_stm = new StreamReader(file_path); while(!inp_stm.EndOfStream) { string inp_ln = stm.ReadLine( ); // Do Something with the input. } inp_stm.Close( ); }


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