Quantcast
Channel: Answers by "gfoot"
Browsing all 95 articles
Browse latest View live

Answer by gfoot

Generally, pay attention to the conventions followed by the functions you're calling, and use the appropriate means to handle the error states they generate. So if the function you're calling throws...

View Article


Answer by gfoot

Answering specifically how to clamp a 3D "direction" vector to be within a certain angle of some other direction called "forwards": direction = Vector3.RotateTowards( forwards, direction, maxRadians, 0...

View Article


Answer by gfoot

Here's a quick guide to the basics of creating a multi-sprite image and importing it into Unity. **Create the image** I use Gimp for this, but any decent 2D art tool should be fine. Start with a...

View Article

Answer by gfoot

I'm not sure about the number of lines, but you should be able to get the required height in pixels using GUIStyle.CalcHeight:...

View Article

Answer by gfoot

Line 7 does a busy-wait for the request to complete. Depending on the WWW implementation (which varies between platforms), the request may or may not be able to complete in the background - on some...

View Article


Answer by gfoot

Do the images have large areas of flat colours? Are they weird shapes? You might be able to split each image into many smaller tiles, and find that many of the tiles are empty, or are filled with just...

View Article

Answer by gfoot

Did you use MeshTopology.Lines? If so, the lines should always be one pixel wide. If not, try that - it's a parameter to Mesh.SetIndices.

View Article

Answer by gfoot

Full AOT compilation is not supported by Mono on all platforms. Last time I investigated (years ago...) it was supported on amd64, but not x86. So you can perform these tests on 64-bit Intel-based...

View Article


Answer by gfoot

Multiply the quaternion by an Euler rotation quaternion like this: transform.rotation = Quaternion.LookRotation(hit.normal) * Quaternion.Euler(0, 0, zAngle); You can also specify a custom "up" axis to...

View Article


Answer by gfoot

Try using axis 9 and axis 10 to read the triggers. This has worked for me in the past, but I think I heard that it doesn't work properly when you have multiple Xbox360 pads connected to the same PC....

View Article

Answer by gfoot

You can use the underlying iterators without creating the unnecessary garbage - essentially, you write what you would have liked the compiler to generate for you. The basic pattern is: var enumerator =...

View Article

Answer by gfoot

They renamed the options, so you can now choose to have explicit meta files or hidden meta files. They are necessary though, and always were, even when they were hidden in the Library folder - you...

View Article

Answer by gfoot

Alt + right mouse button + drag horizontally

View Article


Answer by gfoot

I think you need to explicitly specify the type when you declare an uninitialized variable: var Distance : float;

View Article

Answer by gfoot

Regarding interpolation and extrapolation, you're right, if the physics frame rate is high then you won't notice much difference. One time when you will particularly notice a difference is if you...

View Article


Answer by gfoot

Depending on the use case you could use a bit field, combining emum values together, but it's not particularly well-supported by the language. It is far clearer to just use a class containing a few...

View Article

Answer by gfoot

Whenever you create a new coin, it will reset the counter. Are you sure you're not creating more coins during the game? Maybe move the initialization to zero out of the Start method, or make the player...

View Article


Answer by gfoot

If you apply an upwards force, then the body will only move upwards. If you want it to move sideways you need to apply a sideways force as well. The "at position" bit doesn't change this, it just make...

View Article

Answer by gfoot

That data is in JSON format, so the easiest way to read it is using a JSON parser like http://wiki.unity3d.com/index.php/SimpleJSON

View Article

Answer by gfoot

When you're drawing the texture you're explicitly telling it to be proportional to the screen size - see the third and fourth arguments to "Rect" here: GUI.DrawTexture(new Rect(0f, 0f, Screen.width *...

View Article
Browsing all 95 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>