Answer by Flynn
Use tranform.InverseTransformDirection(dir); To convert local directions to global coordinates. For example: rigidbody.AddForce(tranform.TransformDirection(inputVector * MoveForce), ForceMode.Force);...
View ArticleAnswer by Flynn
Any changes done while the game is playing are undone when the editor stops playing. Make sure you add your scripts while the editor is not playing
View ArticleAnswer by Flynn
For simple rotation, definitely just write a script. Animations themselves are backed by far more complicated scripts that deal with interpolation types, beziers all kinds of things, as well as reading...
View ArticleAnswer by Flynn
function ammoPickedUp (ammoPickUp : int) { if (ammoMG <= 200){ ammoMG += ammoPickUp; } } Let's walk through this. If you have 199 bullets left, and you ask it to add ten, then first, it will check...
View ArticleAnswer by Flynn
rigidbody.isKinematic = true; Will cause your rigidbody to cease calculating. If you set it to true again, it will pick right back up where it left off :) So yes, isKinematic will pause your rigidbdy...
View ArticleAnswer by Flynn
1. Go to your project, and click create > new prefab 2. Drag the projectile you have in your heirarcy onto the new prefab 3. Rename the prefab as you like 4. Drag the prefab from the project folder...
View ArticleAnswer by Flynn
Unity gets confused when there is a folder named Assets in your project, you will need to rename it: Close the project, then click on Open Project, click the find button, and click on your project...
View ArticleAnswer by Flynn
You can do this without JS thankfully! :) Just start your webplayer up like this: unityObject.embedUnity("unityPlayer", "fit2cure.unity3d", "100%", "100%", params); Then carefully set up all of your...
View ArticleAnswer by Flynn
C# is a bit more strict with how you are supposed to do things than JS -- It wants your functions to be clearly defined as iterator blocks, and it wants you to strictly call them using StartCoroutine....
View ArticleAnswer by Flynn
Using AOV instead of FOV might help! public var minFOV : float = 1; public var baseFOV : float = 0; public var czoom : float = 0; function Start () { baseFOV = Camera.main.fieldOfView; } function...
View ArticleAnswer by Flynn
Unfortunately, the answer appears to be no. :( You can double check this yourself by going to [http://docs.unity3d.com/Documentation/ScriptReference/MonoCompatibility.html][1] I believe that "Micro"...
View ArticleAnswer by Flynn
If I understand your requirements, this should work: Vector3[] vertices = new Vector3[faces.Length*3]; int[] tris = new Vector3[faces.Length*3]; for (int i = 0; i < faces.Length;) { for (int j = 0;...
View ArticleAnswer by Flynn
Theoretically, setting timesScale to 0 right when you press the New Game button would work (unless you have some kind of crazy cool animation going on), however, if that is not an option, you can try...
View ArticleAnswer by Flynn
You will need to encapsulate your integers in a Vector3, like this: if(Input.GetMouseButtonDown(0) && collider.Raycast(Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, (Screen.height...
View ArticleAnswer by Flynn
Hello, there! First of all, I suggest that instead of using boolean signals to tell SpawnEnemy to spawn, that you instead go a little more directly: ###EnemySpawn.js: #pragma strict var prefab :...
View ArticleAnswer by Flynn
Honestly, there really aren't many ways to clean up your code's redundancy (without seriously overcomplicating your code and getting into sticky things like delegates...... blech). However, one last...
View ArticleAnswer by Flynn
That depends! Generally, if you are developing for web-player, do NOT exceed a 700 pixel height. Many users have smaller screens, and on top of that, the web browser will eat a good 100 pixels of that...
View ArticleAnswer by Flynn
GUI.Enabled is intended to be used in the OnGUI() function -- The idea is that you set GUI.Enabled to false right before the code that draws the button, then set GUI.Enabled back to true right after...
View ArticleAnswer by Flynn
**TL;DWR:** ***Use AddTorque without considering what point on the object you are applying torque at. This is the physically correct way to do it, and is equivalent to Lockstep's solution, except that...
View Article