How to write more clearer yo! Here are a some tools that automatically analyse your writing and make suggestions on how to improve. Hemmingway seemed to be the most immediately useful to me.These tools are all online so you should not test unpublished confidential material on them. I took existing content from a variety of websites as well as some text from HPL to test them. I'm making this blog post like so many others so I can remember where to find these links later.
1 Comment
Now, Who ya gonna call?Sample Code: //This script attached to the camera lets you rotate it around the Y axis.
using UnityEngine; using System.Collections; public class mems : MonoBehaviour { // Use this for initialization void Start () { Input.compass.enabled = true; Input.location.Start(); Screen.sleepTimeout = (int)SleepTimeout.NeverSleep; } void OnGUI() { transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0,Input.compass.magneticHeading, 0),Time.deltaTime*2); } } Seeing as I've probably learned this, forgotten it and had to google it at least 10 times now, the way you listen in on running Android APP once you've enabled Android debugging and are connected over USB, is to open a dos box and use logcat from the android debugger aka ADB. Now to figure out why loading MP3's in Unity is so slow. My app wasn't crashed, it was just taking 9 seconds to load an admittedly large music file.
A coworker needed to get some data from a json file into excel. I'd been meaning to take a look at json as a replacement for xml in a few different projects so I volunteered to do the data conversion.
Turns out reading in a giant array of record and then printing them out is about as simple as you could imagine: import json #in your main function do something like this: fileName = sys.argv[1] data = json.loads(open(fileName).read()) for i in data: sstr = str(data[i]["guid"])+"," #names of the elements in the json record sstr+= data[i]["name"]+"," .... sstr+= str(data[i]["fsr"])+"\n" print sstr, A LERP (linear interpolation) returns you a value based on start and end key values and a fraction of the interpolation. E.g:
But if we replace the fraction with something non linear as long as its a function that returns a result in the range 0..1 we can get some more interesting results. Trig curves like Sine are a good candidate and allow the creation of movement that has smooth acceleration and deceleration. For my example I wanted to interpolate from key A to key B and then back to key A, so the part of the sin curve I should use goes from 0..PI. So I take my input fraction, scale it by PI and then generate the Sin and I get a lovely smooth interpolation and back again. If you simply wanted to go from Key A to Key B you would use 0..1/2PI.
//When something scary happens momentarily zoom the camera float inter = (1.0f*fearCounter)/FEARCOUNTER; //linear inter*= 3.1415f; inter = Mathf.Sin(inter); float fov = Mathf.Lerp(cameraFOV,cameraFOV/2.0f, inter); localCamera.fieldOfView =fov; Yesterday I imported some new assets, then created a giant level with several mazes using them and then when I came to light mapping I found out that I didn't have any UVs suitable for lightmapping and so I had the throw the entire level away and start from scratch. Which SUCKED. Lesson: On asset import, check the option for Generate Lightmaps. This dialog on appears once and you only get one chance Lesson: This is meant to be fun right? :-( Well at least it looks KINDA AWESOME! Lesson:
Use prefabs properly. Prefabs allow you to change every instance of an object in the scene in a single location. However the UI is different to most other packages I've used. In MOST packages when you make a change to an instanced object you are asked if you making a change to only that instance or all of them. In Unity it works the other way around, the changes are always local unless you apply them using the prefab dialog: This is something that has been bugging me for a while. My game has heavy fog in it, which is fine through the game camera but means that when you zoom out in the Scene Editor everything is fogged in and you can't see anything. I've been turning the fog off in Edit->Render Settings and often I forget to turn it back on. Its an annoying workflow. Turns out you can toggle a variety of effects on and off for the scene editor and fog is one of these. Lighting is another, which will be useful for sinister night levels, I'm sure.
Debugging some code for visibility testing. I need to know when The Duchess can be seen by the player,
Casting a ray and getting some odd results. Turns out my Y coordinates are on the ground. I must have set my local origins at the bottom of my models. I need to do the ray cast at eye level to work correctly. Using the DebugLine functionality was a quick way to figure this out. Debug.DrawLine(transform.position,player.transform.position, Color.red); The characters in my game are made from a prefab that is essentially an empty game object with children that are renderable. The problem is that as this empty object doesn't have a Renderable, there is no bounding box available for frustum culling. So we need to find its children and aggregate them for visibility determination.
Finding the children is actually quite easy as shown below once you know they are accessed through Transforms. Fortunately I don't need to aggregate the children to generate the bounding box because of the way my models are designed. Basically I just need to know if the face is on screen. Plane[] planes = GeometryUtility.CalculateFrustumPlanes(localCamera); if(GeometryUtility.TestPlanesAABB(planes, souls[i].transform.Find("face").renderer.bounds)) { print ("Visible"); } Back to work on the game finally and a vertical slice is basically complete but test runs on Android were showing very poor performance. The culprit is Unities terrain system which is very nice but a bit heavy for mobile. There is an app called T4M that converts Unity terrains into meshes which helps solve this problem, or I could simply model the terrain in a different package and export it as a static mesh.
I also started putting some assets into the game including some dead trees and spooky looking tombs which is making the whole thing look a bit creepier. More tomorrow hopefully. |
David CoombesMaking stuff Categories
All
Archives
February 2024
|