Answer by Hullu
Im not sure what you are trying to do, but here is fix for your current code: **Change** > if(transform.rotation.z > 16) {>> transform.rotation.z = 16; } **To** >...
View ArticleAnswer by Hullu
I'm not sure if i understood you correctly, but do you mean like football game? So when the player is facing the ball something happens. If im right, one way to do this is with...
View ArticleAnswer by Hullu
With this you can find all colliders around the object: http://docs.unity3d.com/ScriptReference/Physics2D.BoxCastAll.html OR you can use circle shape...
View ArticleAnswer by Hullu
Use **capsule collider**. Adjust the center, height and radius to make sure the collider is not "inside" the terrain.
View ArticleAnswer by Hullu
http://docs.unity3d.com/ScriptReference/LineRenderer.SetPosition.html lineRenderer.SetPosition(0, transform.position) lineRenderer.SetPosition(1, target.position) this renders line from index 0...
View ArticleAnswer by Hullu
Maybe because minutes is *float**? Haven't tested this tho: var guiTime = Time.time - startTime; var minutes : int = guiTime / 60; var seconds : int = guiTime % 60; textTime = String.Format...
View ArticleAnswer by Hullu
Something like this should work, haven't tested: void OnGUI () { if(!networkView.isMine) { Vector3 screenPos = Camera.main.WorldToScreenPoint(transform.position); screenPos.y = Screen.height -...
View ArticleAnswer by Hullu
1) Use GetComponent: gameObject.GetComponent(); 2) Attach it to empty gameobject for example. Then you can find the enviroment script from your "player script" like this: var gamecontroller :...
View ArticleAnswer by Hullu
I don't know much about RainAI or smoothpath, but i have used http://arongranberg.com/astar/ Here is tutorial for how to use astar, and (lucky you) on tower defence game:...
View ArticleAnswer by Hullu
You could do it this way: public GameObject[] buildings; void Start() { buildings = GameObject.FindGameObjectsWithTag("building"); } and then get the current amount of "buildings" with this:...
View ArticleAnswer by Hullu
In animation component, uncheck "Play Automatically". function LoadNextLevel (level_to_load : int) { animation.Play(animation.clip.name); yield WaitForSeconds (animation.clip.length);...
View ArticleAnswer by Hullu
I think the scripting reference explains it perfectly http://docs.unity3d.com/ScriptReference/Physics.Raycast.html For example this casts ray from your camera to mouse position when you click left...
View ArticleAnswer by Hullu
Have you tried having it like this: IEnumerator Die(){ yield return new WaitForSeconds(transform.animation["Death"].length); if( GetComponent().instantiationId == 0 ){ Destroy(gameObject); //etc...
View ArticleAnswer by Hullu
You need to add **Rigidbody** to the trigger. You also might want to check **IsKinematic**
View ArticleAnswer by Hullu
Try this //Replace this EndLevel(n); //With this StartCoroutine(EndLevel(n)); IEnumerator EndLevel(int n){ yield return new WaitForSeconds(5); //stuff } For accessing score etc... I would suggest...
View ArticleAnswer by Hullu
Try something like this yield return StartCoroutine(EnemyContactTimer()); The **OrganiseChildren** should pause untill **EnemyContactTimer** is finished
View Article
More Pages to Explore .....