Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official TANKS! Tutorial Q&A

Discussion in 'Community Learning & Teaching' started by willgoldstone, Sep 21, 2015.

  1. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
  2. jigsy1

    jigsy1

    Joined:
    Nov 21, 2015
    Posts:
    7
    Hi there! i am currently doing the tank tutorial, very much enjoying it but am a little stuck on the tank movement script, when trying to define the engine audio 'if' statement using the Mathf.abs function i get an error message and was hoping someone could help me with it, my section of script is

    if (Mathf.Abs (m_MovementInputValue) < 0.1f && Mathf.Abs && Mathf.Abs (m_TurnInputValue) < 0.1f)

    and i get an error message: operator '&&' cannot be applied to operands of type 'bool' and 'method group'

    Please help, thanks
     
  3. SunstormGT

    SunstormGT

    Joined:
    Mar 18, 2015
    Posts:
    16
    If you look closely at:

    if (Mathf.Abs (m_MovementInputValue) < 0.1f && Mathf.Abs && Mathf.Abs (m_TurnInputValue) < 0.1f)

    you might see the problem there yourself ;)

    It should be:

    if (Mathf.Abs (m_MovementInputValue) < 0.1f && Mathf.Abs (m_TurnInputValue) < 0.1f)

    just remove 1x && Mathf.Abs and it will work fine!
     
  4. jigsy1

    jigsy1

    Joined:
    Nov 21, 2015
    Posts:
    7
    Tanks alot! bad puns aside that did work thankyou
     
  5. NewYearRain

    NewYearRain

    Joined:
    Nov 25, 2015
    Posts:
    2
    Hi. I'm new in Unity. I'm actually a electrical engineer. So A week ago. I started learning Tank tutorial.
    In ShellExplosion script, there is a code:

    Code (CSharp):
    1. Rigidbody targetRigidbody = colliders[i].GetComponent<Rigidbody> ();
    OK, as far as I know, The game object contain component. So when using GetComponent<Type> that mean you get a component from a gameobject and assign it to a instance.
    But the code above, collider is a component. How can it contain another component?
    The instructor said the code will scan all colliders and if they have rigidbody inside then assign the Rigidbody for "targetRigidbody"?

    The next code is even more confused:

    Code (CSharp):
    1.  TankHealth targetHealth = targetRigidbody.GetComponent<TankHealth> ();
    The TankHealth is script we wrote before, so use it to call function
    TakeDamage.
    But again, targetRigidbody is Rigidbody, why does it have script?
    Can you help me? Thank
     
  6. Hank9527

    Hank9527

    Joined:
    Nov 25, 2015
    Posts:
    2
    Please post your code and screenshot of your game project...I suggest you guys to check out
    Rich Text ---Unity Docs..
     
  7. jinumm

    jinumm

    Joined:
    Nov 26, 2015
    Posts:
    3
    these assest i use for commercial purpose?
     
  8. jinumm

    jinumm

    Joined:
    Nov 26, 2015
    Posts:
    3
    Hi there

    Quick question for you all (hopefully someone can help) I have used my own tank model and I would like the tanks to be coloured for each player but not my tank tracks which are a separate asset to the tank body? The tracks are however a child object of the tank prefab which is giving them the colour.

    Is there another way attach the tracks without the colour?

    Thanks Tim , thanks alote
     
  9. jjasonkschaefer

    jjasonkschaefer

    Joined:
    Dec 1, 2015
    Posts:
    2
    Thank you for posting this very insightful entry.
     
  10. RachManGo

    RachManGo

    Joined:
    Dec 1, 2015
    Posts:
    1
    Hello People,
    Any idea how to introduce touchscreen settings to this game? i.e. to make it work on Android or any touchscreen device
    Does it have anything to do with the .axis?
     
  11. Narwrynn

    Narwrynn

    Joined:
    Sep 13, 2014
    Posts:
    1
    Noobiest question. I don't see a download link in the asset store just the link and social media buttons. Am I missing something?
     
  12. jigsy1

    jigsy1

    Joined:
    Nov 21, 2015
    Posts:
    7
    if you search tank tutorial in the asset store there is a link that says 'open in unity' and the assets should be available to download in unity, have you got version 5.2.0 or higher?
     
  13. sheng1122

    sheng1122

    Joined:
    Dec 5, 2015
    Posts:
    1
    Newbie need help.
    I want to add a scene (lets call it sceneA) before user can enter to LobbyScene, this scene will have a button that can link user to LobbyScene. And, at LobbyScene, there will have a button that can bring user back to sceneA. How to do this?
     
  14. Oscaruzzo

    Oscaruzzo

    Joined:
    Jan 26, 2015
    Posts:
    17
    Hi, I'm doing this tutorial right now. I'm on "episode 3 - Camera Control". I have just one doubt at the moment.

    In the script "CameraControl.cs" in FindRequiredSize() you use transform.InverseTransformPoint both on m_DesiredPosition and on m_Targets[ i ].position.

    I don't understand why. In fact, the script works perfectly fine if I rewrite this method like this

    Code (CSharp):
    1.     private float FindRequiredSize()
    2.     {
    3.         Vector3 desiredLocalPos = m_DesiredPosition;
    4.         // WAS: Vector3 desiredLocalPos = transform.InverseTransformPoint(m_DesiredPosition);
    5.  
    6.         float size = 0f;
    7.         for (int i = 0; i < m_Targets.Length; i++)
    8.         {
    9.             if (!m_Targets[i].gameObject.activeSelf)
    10.                 continue;
    11.  
    12.             Vector3 targetLocalPos = m_Targets[i].position;
    13.             // WAS: Vector3 targetLocalPos = transform.InverseTransformPoint(m_Targets[i].position);
    14.  
    15.             Vector3 desiredPosToTarget = targetLocalPos - desiredLocalPos;
    16.             size = Mathf.Max (size, Mathf.Abs (desiredPosToTarget.y));
    17.             size = Mathf.Max (size, Mathf.Abs (desiredPosToTarget.x) / m_Camera.aspect);
    18.         }
    19.        
    20.         size += m_ScreenEdgeBuffer;
    21.         size = Mathf.Max(size, m_MinSize);
    22.         return size;
    23.     }
    Am I missing something?
     
  15. NewYearRain

    NewYearRain

    Joined:
    Nov 25, 2015
    Posts:
    2
    In GameManager script, function GetRoundWinner(), can I put it in Tank Manager? and the result is still the same?
     
  16. badrenanna

    badrenanna

    Joined:
    Dec 19, 2015
    Posts:
    4
    thank you so much for this tutorial !
     
  17. Mr. Rius

    Mr. Rius

    Joined:
    Dec 21, 2015
    Posts:
    1
    hey! i like this project but i can't make this:( in the phase 3. problem: I don't see a "targets" thing in the camera control script in camare rig:( someone can help me in this please...
     

    Attached Files:

    • uni1.png
      uni1.png
      File size:
      309.3 KB
      Views:
      998
  18. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    not sure if you have taken this script from the completed folder or not.

    Have a look at your CameraControl script, for the m_Targets array at the top, check that line has the HideInInspector commented out.

    Code (CSharp):
    1.         /* [HideInInspector] */ public Transform[] m_Targets;
     
  19. AguiarRobert

    AguiarRobert

    Joined:
    Dec 27, 2015
    Posts:
    1
    I am having this error and don't know how to fix it


    upload_2015-12-28_1-16-27.png
     
  20. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Morning @AguiarRobert,

    Can you post your code for the lines 68 and 76 section please.

    Just guessing until we can see your code, but AudioSource has a pitch property but the Clip doesn't.
    check that you havent entered
    Code (CSharp):
    1. m_MovementAudio.clip.pitch
    where it should be
    Code (CSharp):
    1. m_MovementAudio.pitch
     
  21. PatrickHedges

    PatrickHedges

    Joined:
    Oct 6, 2013
    Posts:
    4
    Excellent Tutorial. I just have some issues.

    Round 1 works ok, except that the explosion force doesn't get applied. Then, when round 2 starts, the screen oes dark, like it's night out. I uploaded a screenshot.

    Any ideas?

    Thanks! Screen Shot 2015-12-28 at 4.48.51 PM.png
     
  22. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Theres an error in the console window I see there, can you post the full error message please.
     
  23. PatrickHedges

    PatrickHedges

    Joined:
    Oct 6, 2013
    Posts:
    4
    Sure, Here is a shot of the console Screen Shot 2015-12-28 at 5.05.55 PM.png Screen Shot 2015-12-28 at 5.07.58 PM.png
     
  24. westergard

    westergard

    Joined:
    May 4, 2015
    Posts:
    90
    Hi WillGoldStone,

    i'm doing this tutorial with my students to learn their first 2 players game. Unfortunately, i'm using unity 5.1 and i won't be able to upgrade to 5.3 until later in the month (our tech guys are pretty busy at our school). I was wondering, since in 5.1 the "colorutility" is not available, how should i modify the tankmanager script and the gamemanager script so that it works. I have an error when i use the code provided because it has the "colorutility" class.

    thanks a lot in advance

    Sebastien
     
  25. westergard

    westergard

    Joined:
    May 4, 2015
    Posts:
    90
    HI Oboshape,

    i'm doing this tutorial with my students to learn their first 2 players game. Unfortunately, i'm using unity 5.1 and i won't be able to upgrade to 5.3 until later in the month (our tech guys are pretty busy at our school). I was wondering, since in 5.1 the "colorutility" is not available, how should i modify the tankmanager script and the gamemanager script so that it works. I have an error when i use the code provided because it has the "colorutility" class.

    thanks a lot in advance

    Sebastien
     
  26. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Hi aye, I'm just a Unity student and a general forum user and learning with everyone else :)

    Think the ColorUtility was brought in with 5.2 looking at the release notes.
    ,
    ( @willgoldstone )
    Think your best speaking with one of the Unity team in regards to you using this within a classroom environment, they can best advise on how should proceed.

    but, it might help others, so thought I would have a dig around, there is an article on the Unity3D wiki page that shows a function to change RGB into hex. in C#.
    http://wiki.unity3d.com/index.php?title=HexConverter
     
  27. thesuperhorse

    thesuperhorse

    Joined:
    Jan 6, 2016
    Posts:
    1
    Did you solve your error? I'm having the same problem.

    I've noticed that if I drag my tankexplosion prefab into the hierarchy, the screen goes black the same way after the explosion animation ends. I tried adding a script to destroy the tankexplosion prefab:
    Destroy(gameObject, 0.059f);
    This didn't solve my problem of screen going black from instantiating tankexplosion in the hierachy. However this did solve my problem that my screen no longer weng black after the second round. New problem occured: 0 health tank no longer exploded and round 2 never ends.

    I deactivate the script I added to tankexplosion prefab. I change endgamewait to see if the screen black is time dependent. It is not. No matter what my wait was, the screen blacked whenever round 2 was loaded.

    Any suggestions how to solve this screen black issue? I will try to solve this problem in the meantime.
     
  28. olykken

    olykken

    Joined:
    Dec 30, 2015
    Posts:
    1
    I solved this problem albeit the solution is what you would consider "bad code". I added the "Destroy (m_ExplosionParticles.gameObject, m_ExplosionParticles.duration);" line of code from the ShellExplosion script's OnTriggerEnter function to the end of the TankHealth OnDeath function after you destroy the tank game object itself. The problem of round 2 not ending was that the explosions are only called in the Awake function of TankHealth but not in the OnEnable function, without the explosions the round will not end. To get around this I called Awake at the end of the OnEnable function (this is the "bad code" part). The game runs fine and will no longer go dark after the second round. I am sure there is a better way to do this so I'll keep playing with it but if you just want to finish her up nice and easy this will do the trick.
     
  29. iknowDavenMC

    iknowDavenMC

    Joined:
    Jan 12, 2016
    Posts:
    1
    I think that the issue is caused by the fact that TankHealth::Awake() is only called when first starting the game. As such, the lines:

    m_ExplosionParticles.Stop();
    m_ExplosionParticles.gameObject.SetActive(false);

    are only called once and so the particles are never deactivated once they are enabled and told to play.

    I fixed the issue by moving those two lines of code into TankHealth::OnEnable() which is instead called when the tank becomes active and thus gets called at the beginning of every round.
     
    GGOBOGI likes this.
  30. aobjects

    aobjects

    Joined:
    Jan 16, 2016
    Posts:
    10
    First:
    I went through this whole tutorial and it's really good. However, my scene Level Art mesh explodes every time on my Android phone and a high percentage of the time of my PC. Here's alink to a screen shot. http://postimg.org/image/yk5ebkdnl/ It looks identical on both my PC and Andorid. Also getting a continuous stream of the following errors... aabb.IsFinite() IsFinite(outDistanceForSort) UnityEditor.DockArea:OnGUI() This was not happening with any other scene I've worked on. Not sure what's up?



    Then This Happened:
    Also now new errors show when fireing the shell... Invalid AABB a IsFinite(outDistanceForSort) IsFinite(outDistanceAlongView) Invalid AABB result This is after opening the master scece from the completed folder.
    Show less
    ·
    So, now I've closed Unity, came a new project, reimported the Tanks Demo from the Asset Store, opened the completed scene and put it right on my Android Tablet and it still borked in the same exact way. It looked like the wacky mesh might beslightly different wacky this go around. Help please, this is LAME and turning me off to Unity with this BS.
    ·

    So, I've already had Unity installed on my laptop. I grabbed the Tanks! Asset Bundle direct from Asset Store and immediately open the complete scene to pop onto mobile device. Same deal!!!!! WTF? It's definitely something to do with the Level Art, I slowly removed the sub objects all but the ground and it finally it would not go nuts. So, note This was Windows 10 and 8.1 (don't hate). I'm going to try it on my Mac now and see what happens. I'll update.
     
  31. DeAngelis

    DeAngelis

    Joined:
    Jan 12, 2016
    Posts:
    1
    I confirm this fixed the screen going dark after first round for me. As a new user, I would have not guessed it was the particles (it did seem like it happened at a very precise point, but it's hard to guess without experience) and I have spent a couple of hours ruining my lighting settings thinking it was the "continuous baking etc." bug, in spite of my Unity version being 5.3.1.
    Tank you very much (ah ah ah), now everything works a treat.

    The only puzzling thing left for me is my console reports a lot of "aabb.IsFinite()", "Invalid AABB a", "IsFinite(outDistanceVariousStuff)" ( ! ) messages.

    But since we're here to learn, why would the particle system cause this ?
     
    Last edited: Jan 17, 2016
  32. alexkren1

    alexkren1

    Joined:
    Jan 17, 2016
    Posts:
    1
    Guys, I have done everything in the above (I had the problem with the screen darkening) but it now says that "the object of type "ParticleSystem" has been destroyed but you are still trying to access it" any help?
     
  33. GGOBOGI

    GGOBOGI

    Joined:
    Jan 20, 2016
    Posts:
    2
    Hi. I have a problem ... It's about my light.

    When I start my game, the light is not a problem. but, when it starts round 2, my light is shut down.

    It may sounds funny, but I tested completed scene. It is created Unity company. And, It also has same problem...




    help me plz..
     
  34. GGOBOGI

    GGOBOGI

    Joined:
    Jan 20, 2016
    Posts:
    2
    Thanks! I solved my problem!!
     
  35. Prince_Of_Autumn

    Prince_Of_Autumn

    Joined:
    Jan 21, 2016
    Posts:
    1
    Whenever any SFX (Shot charging, shot firing, explosion, etc,) plays, the entire driving audio cuts off, and the shell explosion sound loops. The engine idling and engine driving sounds don't return after a round is over either.

    If you need any other information, I will provide. This bug is super annoying and I'm not sure what's causing it.
     
  36. RockmanZ

    RockmanZ

    Joined:
    Feb 4, 2016
    Posts:
    2
    Thank you for getting me out from the same problem. I also added the "Destroy (m_ExplosionParticles.gameObject, m_ExplosionParticles.duration);" line of code to the end of the TankHealth OnDeath function, to destroy the particles object.

    I was wondering why a particle game object can affect the lights. I will be appreciated if any one give me some references.
     
  37. RockmanZ

    RockmanZ

    Joined:
    Feb 4, 2016
    Posts:
    2
    Hi, simple AI can be achieved by using Unity's navigation system. You can follow the Survival Shooter tutorial to learn the codes. They are in phase 4 in that tutorial. Unity documentation also has some basic references about navigation.
    Another part of an AI enemy is shooting. You can use the Update() function in TankShooting.cs from this TANKS! tutorial as prototype to code your own EnemyShooting.cs. The tricky part of this is to simulate keyboard input. I will just post my code here. It is not hard, so I think I am not very generous.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class EnemyShooting : MonoBehaviour {
    5.  
    6.     public Rigidbody m_Shell;                   // Prefab of the shell.
    7.     public Transform m_FireTransform;           // A child of the tank where the shells are spawned.
    8.     public AudioSource m_ShootingAudio;         // Reference to the audio source used to play the shooting audio. NB: different to the movement audio source.
    9.     public AudioClip m_ChargingClip;            // Audio that plays when each shot is charging up.
    10.     public AudioClip m_FireClip;                // Audio that plays when each shot is fired.
    11.     public float m_MinLaunchForce = 15f;        // The force given to the shell if the fire button is not held.
    12.     public float m_MaxLaunchForce = 30f;        // The force given to the shell if the fire button is held for the max charge time.
    13.     public float m_MaxChargeTime = 0.75f;       // How long the shell should charge for before it is fired at max force.
    14.  
    15.     public float m_ForceError = 2f;             // The error of launch force used to simulate keyboard input.
    16.     [HideInInspector] public Transform m_TargetPlayer;           // Attack target, assigned by GameManager class.
    17.  
    18.     private float m_CurrentLaunchForce;         // The force that will be given to the shell when the fire button is released.
    19.     private float m_ChargeSpeed;                // How fast the launch force increases, based on the max charge time.
    20.     private float m_CurrentChargeTime;          // Record indicates how long the shell has been charged.
    21.     private bool m_Fired;                       // Whether or not the shell has been launched with this button press.
    22.     private bool m_ShellIsCharging;             // Whether or not the shell is being charged.
    23.  
    24.     private void OnEnable(){
    25.         // When the enemy is turned on, reset the launch force
    26.         m_CurrentLaunchForce = m_MinLaunchForce;
    27.     }
    28.        
    29.     // Use this for initialization
    30.     private void Start () {
    31.         // The rate that the launch force charges up is the range of possible forces by the max charge time.
    32.         m_ChargeSpeed = (m_MaxLaunchForce - m_MinLaunchForce) / m_MaxChargeTime;
    33.  
    34.     }
    35.  
    36.    
    37.     private void Update () {
    38.         // Calculate the distance from this enemy to the target.
    39.         float targetDistance = (m_TargetPlayer.position-transform.position).magnitude;
    40.  
    41.         // If the max force has been exceeded and the shell hasn't yet been launched...
    42.         if (m_CurrentLaunchForce >= m_MaxLaunchForce && !m_Fired)
    43.         {
    44.             // ... use the max force and launch the shell.
    45.             m_CurrentLaunchForce = m_MaxLaunchForce;
    46.             Fire ();
    47.         }
    48.         // Otherwise, if the shell has just started being charged...
    49.         else if (ShellChargeStart(targetDistance))
    50.         {
    51.             // ... reset the fired flag and reset the launch force.
    52.             m_Fired = false;
    53.             m_CurrentLaunchForce = m_MinLaunchForce;
    54.  
    55.             // Change the clip to the charging clip and start it playing.
    56.             m_ShootingAudio.clip = m_ChargingClip;
    57.             m_ShootingAudio.Play ();
    58.         }
    59.         // Otherwise, if the shell is charging and it hasn't been launched yet...
    60.         else if (m_ShellIsCharging && !m_Fired)
    61.         {
    62.             // Increment the launch force.
    63.             m_CurrentLaunchForce += m_ChargeSpeed * Time.deltaTime;
    64.         }
    65.         // Otherwise, if the shell is charged and it hasn't been launched yet...
    66.         else if (ShellChargeComplete (targetDistance) && !m_Fired)
    67.         {
    68.             // ... launch the shell.
    69.             Fire ();
    70.         }
    71.     }
    72.      
    73.  
    74.     private bool ShellChargeStart(float distance){
    75.         // If the target is close enough...
    76.         if (distance < m_MaxLaunchForce)
    77.         {
    78.             // ... and the shell is not being charged.
    79.             if (!m_ShellIsCharging)
    80.             {
    81.                 // ... confirm to start charging the shell.
    82.                 m_ShellIsCharging = true;
    83.                 return true;
    84.             }
    85.             // Otherwise, the shell is already charging, ...
    86.             else
    87.                 // ... so keep charging.
    88.                 return false;
    89.         }
    90.         // Otherwise, target is too far away...
    91.         else
    92.         {
    93.             // ... then make sure the shell is not charging.
    94.             m_ShellIsCharging = false;
    95.             return false;
    96.         }
    97.     }
    98.  
    99.  
    100.     private bool ShellChargeComplete(float distance){
    101.         // Make sure the shell is charging.
    102.         if (m_ShellIsCharging)
    103.         {
    104.             // Reset the charging flag.
    105.             m_ShellIsCharging = false;
    106.        
    107.             // If the shell is over-charged, it is charged completely.
    108.             return m_CurrentLaunchForce > distance;
    109.         }
    110.         // Otherwise, no way we can talk about "complete".
    111.         else
    112.             return false;
    113.     }
    114.  
    115.     private void Fire(){
    116.         // Set the fired flag so the Fire function is only called once.
    117.         m_Fired = true;
    118.  
    119.         // Create an instance of the shell and store a reference to its rigidbody.
    120.         Rigidbody shellInstance =
    121.             Instantiate(m_Shell, m_FireTransform.position, m_FireTransform.rotation) as Rigidbody;
    122.  
    123.         // Set the shell's velocity to the launch force in the fire position's forward direction.
    124.         // Also add some random interference.
    125.         shellInstance.velocity =
    126.             (m_CurrentLaunchForce + Random.Range(-m_ForceError, m_ForceError)) * m_FireTransform.forward;
    127.  
    128.         // Change the clip to the firing clip and play it.
    129.         m_ShootingAudio.clip = m_FireClip;
    130.         m_ShootingAudio.Play();
    131.  
    132.         // Reset the launch force.
    133.         m_CurrentLaunchForce = m_MinLaunchForce;
    134.     }
    135. }
     
    BerniceChua likes this.
  38. FlappyFingers

    FlappyFingers

    Joined:
    Feb 4, 2016
    Posts:
    1
    Hey, I have a question, in the shooting script, the shell is instantiated and fired with the function:
    Code (CSharp):
    1.     private void Fire()
    2.     {
    3.         // Instantiate and launch the shell.
    4.         m_Fired = true;
    5.         Rigidbody shellInstance = Instantiate(m_Shell, m_FireTransform.position, m_FireTransform.rotation) as Rigidbody;
    6.         shellInstance.velocity = m_CurrentLaunchForce * transform.forward;
    7.         //m_ShootingAudio.clip = m_FireClip;
    8.         // m_ShootingAudio.Play();
    9.         m_CurrentLaunchForce = m_MinLaunchForce;
    10.     }
    This instatiates the shell at the firetransform, sets its rotation to the fire transform and launches it forwards...

    As per the tutorial, the firetransform is set so that it's rotated on it's X so that it's Z axis is pointing slightly upwards, not straight ahead,

    Therefore the shell is rotated when it's instantiated so that it's pointing slightly upwards,

    but shellInstance.velocity = m_CurrentLaunchForce * transform.forward;
    just seems to launch the shell straight ahead along a global z axis, instead of diagonally upwards along its angle of rotation.

    I'm new to 3D and I'm still getting my brain around Quaternions and Eulers and Vectors of Velocity. how do I set the shellInstance.velocity so that it travels in the direction of my Fire.Transform?

    *EDIT*

    Actually, after a little more investigation, I actually figured it out. For anyone interested, using the following Fire() function will mean that your tank shoots along it's firetransform Z instead of straight ahead:

    Code (CSharp):
    1.     private void Fire()
    2.     {
    3.         // Instantiate and launch the shell.
    4.         m_Fired = true;
    5.         Rigidbody shellInstance = Instantiate(m_Shell, m_FireTransform.position, m_FireTransform.rotation) as Rigidbody;
    6.         shellInstance.AddForce(m_FireTransform.forward * m_CurrentLaunchForce);
    7.         m_ShootingAudio.clip = m_FireClip;
    8.         m_ShootingAudio.Play();
    9.         m_CurrentLaunchForce = m_MinLaunchForce;
    10.     }
     
    Last edited: Feb 4, 2016
  39. mattolf

    mattolf

    Joined:
    Feb 10, 2016
    Posts:
    1
    Hello There, I've just finished the tank tutorial, my second dip into unity after the 3d survival game, again it was a great project with really high quality stuff so thanks, I'm looking forward to tackling the networked version soon.
     
  40. RohailTariq

    RohailTariq

    Joined:
    Jan 7, 2015
    Posts:
    8
    Hi! I'm trying to moving the tank through mobile input through Unity Cross Platform Assets. But this isn't working for me. Can anyone guide me through it? Thanks
     
  41. bgk1

    bgk1

    Joined:
    Feb 12, 2016
    Posts:
    1
    I just finished the Camera Control video and my camera spins along with the tank as it turns. It's pretty nauseating. My script was copied and pasted from the tutorial page so I don't understand why it is doing that.

    Edit: Nevermind. I had my camera rig set as a child to the tank.The camera rig has to be on the root.
     
    Last edited: Feb 23, 2016
  42. bin381

    bin381

    Joined:
    Mar 7, 2016
    Posts:
    1
    hi,in my tank tutorial.The tankexplosion is wired.it can not remove from the Hierarchy.Last,it make the scene black.
    i build the completescene and run,when the tank dies,and the the tankexlposion plays,the scene will turn to be black
     

    Attached Files:

    • 2.pic.jpg
      2.pic.jpg
      File size:
      103.2 KB
      Views:
      912
    • sth.jpg
      File size:
      693.1 KB
      Views:
      865
  43. kmunyoke

    kmunyoke

    Joined:
    Apr 15, 2016
    Posts:
    2
    Hi there, I am new to Unity and have just been watching these amazing tutorials to build games. I have managed to finish the TANKS! tutorial and have encounter a problem after building the game.

    I noticed that the graphic settings of the original game in the Unity editor and the after built is different (Please refer to below screenshots) and I would very much like to build the game the same as in the Unity editor's (first picture) graphic.
    I am wondering how do I do so to change the graphic settings to the first picture instead of the second one. Please help and many thanks in advance!

    The pic below is the game in Unity editor:
    upload_2016-4-15_16-0-2.png

    The pic below is the game after built:
    upload_2016-4-15_16-4-2.png


    I am wondering if anyone could please answer my question and I would sincerely appreciate your time taken to do so. Thank you very much! Cheers!
     
  44. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    244
    It looks like all of your image effects are turned off in the editor but not on the final build. Is that your problem? Besides the tank color changing, I don't really see any other difference.
     
    SimonDarksideJ likes this.
  45. kmunyoke

    kmunyoke

    Joined:
    Apr 15, 2016
    Posts:
    2
    Hi Mike, thanks for taking time to reply me! Appreciate it! The tank color was my mistake. And yes I was just wondering how do I could turn the image effects off in the final build. But after some discovering here and there and playing around with Unity Editor, I am able to resolve the issue finally!

    I would also like to let you guys know that you guys are doing amazing work with the tutorials! I have learn a lot and really like to extend my appreciation to your team! Thank you very much and hope to see more videos coming soon! Cheers! :)
     
  46. TACOKING11

    TACOKING11

    Joined:
    May 28, 2016
    Posts:
    3
    I'm working on phase 3 in the Tanks! tutorial and I can't find the targets section. [HideInInspector] is commented out.
    Please help!
     
  47. TACOKING11

    TACOKING11

    Joined:
    May 28, 2016
    Posts:
    3
    It's fine I figured out that deleting it helped! :)
     
  48. TACOKING11

    TACOKING11

    Joined:
    May 28, 2016
    Posts:
    3
    Hi, I can't get the camera to follow me and if it does it only focuses on one side of the tank.
    Please help!
    :mad::(
     
  49. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    The code should be
    Code (CSharp):
    1. if(Mathf.Abs(m_MovementInputValue)<0.1f &&Mathf.Abs (m_TurnInputValue) < 0.1f)
    You added a
    Code (CSharp):
    1. && Mathf.Abs
    between
    Code (CSharp):
    1. if(Mathf.Abs(m_MovementInputValue)<0.1f
    and
    Code (CSharp):
    1. Mathf.Abs (m_TurnInputValue) < 0.1f)
    .
     
  50. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    I have a weird bug. I can only move the tank up and down, not left and right, even if I rotate the tank left or right and then press up and down. I figured that maybe the tank moved along only on the zeta axis but I copied and pasted the code from the tutorial to my code and the same thing happened. Either its the tutorial's code that is glitching or it is just me. What should I do?

    P.S. I tested the completed scene and everything works fine. What is happening?

    Edit: Whoops! I accidently froze the z position in the rigidbody. Why did I do that?
     
    Last edited: Jun 5, 2016