Search Unity

Car Tutorial

Discussion in 'Community Learning & Teaching' started by antenna-tree, Apr 24, 2010.

  1. drift501

    drift501

    Joined:
    Apr 20, 2012
    Posts:
    76
    Hello. Whenever I import the tutorial into a project I get a whole bunch of errors. That doesn't really matter that much because it still works but it makes it hard to find errors in my scripts. But the main reason I am postin is that whenever I close unity and then re-open it the next day or whenever the models and scripts and everything are just gone. The files are still there but in the inspector it just says things like missing mesh and missing script. Any help would be much appreciated. Thanks, Zac.
     
  2. pinchmass

    pinchmass

    Joined:
    Jul 2, 2012
    Posts:
    156
    Is their any other source (asset store) or on the forums (that I have not come across) for a very simple (arcade if you like/mario kart) and also I presume very efficient car rig out their.

    Or would this actually be possible with a character controller and I'm over thinking it
     
  3. wipyk

    wipyk

    Joined:
    Aug 5, 2012
    Posts:
    10
    Sucks!
    This is nothing!! Or is this normal?
    http://www.kephost.com/view3.php?filename=a1_2012_9_11_clvf8p8002.jpg
     
  4. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    No it's not normal. Looks like you are missing the level geometry. In the hierarchy window select the object called Track. Move the mouse into the Scene view, then press the 'f' key. That should show you where the track object is. Maybe the track is moved far away from the car. Did you console window show any errors?
     
  5. LtKelleyUSMC

    LtKelleyUSMC

    Joined:
    Oct 6, 2012
    Posts:
    45
    That is really KEWL. Check out my video on YouTube of what I have produced with these TUTORIALS. It is MY racing game... A lot of this comes from Andrew Gotow's tutorial...

    http://www.youtube.com/watch?v=nrXn-xqh9VA
     
    Last edited: Mar 31, 2013
    adel_deli likes this.
  6. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
  7. mutazalhawash

    mutazalhawash

    Joined:
    Oct 18, 2012
    Posts:
    21
    Interesting i used that tutorial to create my graduation project before a year and it was really very helpful and useful :D thanks Unity
     
  8. LouisSong

    LouisSong

    Joined:
    Apr 13, 2013
    Posts:
    4
  9. 2013GameLearner

    2013GameLearner

    Joined:
    Apr 22, 2013
    Posts:
    5
    I worked on Unity 3D Car Tutorial which can be found in "http://unity3d.com/gallery/demos/demo-projects". After finishing first pdf, the second one says, the car should move, but will flip etc.However, my car doesnot move and strangely, my game screen doesnot get maximized either when I use mine to play. What am I doing wrong ?

    When I open the console, I see 2 errors. Appreciate the community feedback

    UnassignedReferenceException: The variable reflectingMaterial of 'Generate2DReflection' has not been assigned.
    You probably need to assign the reflectingMaterial variable of the Generate2DReflection script in the inspector.
    Generate2DReflection.Start () (at Assets/Scripts/CSharpScripts/Generate2DReflection.cs:18 )

    UnassignedReferenceException: The variable brakeLights of 'Car' has not been assigned.
    You probably need to assign the brakeLights variable of the Car script in the inspector.
    Car.GetInput () (at Assets/Scripts/JavaScripts/Car.js:254)
    Car.Update () (at Assets/Scripts/JavaScripts/Car.js:91 )

    Appreciate the Game community feedback.

    Thanks
     
  10. 2013GameLearner

    2013GameLearner

    Joined:
    Apr 22, 2013
    Posts:
    5
    Okay, Feeling Good. Solved my own problem. Just for reference to help others in case they have similar problems
    In Car Game Object,
    1)Go to Inspector and in Brake Lights, choose CAR_Lights
    This will get rid of the brakelights variable error
    2)Again Go To Inspector and remove Generate2DReflection component. That reflecting material. I am not sure, if it came out of box from tutorial or I added. Whatever, if you remove, things are good and car moves

    Thanks
     
  11. TerraCo

    TerraCo

    Joined:
    Jun 8, 2013
    Posts:
    26
    Getting the following error when deploying the game to any platform. The game runs fine in the editor, and this only happens when using a car from the Alternate Physics folder. The regular car works, but I'm not too happy with the physics of that one (accelerating without pressing buttons etc)

    When I click on the error in the list, it says the issue comes from line 268 of Wheel.cs
    $error.png
     
    Last edited: Jun 8, 2013
  12. Divinux

    Divinux

    Joined:
    Jul 5, 2011
    Posts:
    205
    So I just spent the whole night figuring out the issue the previous poster had. Long story short for anyone stumbling upon this issue later on - don't give up, it still runs properly on Unity 4.

    You have most likely seen this

    http://answers.unity3d.com/questions/364586/car-tutorial-raycast-issue-since-upgrade-unity-4-b.html

    and this

    http://forum.unity3d.com/threads/40806-Script-not-working-in-build-ok-in-editor

    by now. Same issue. after updating to U4 scripts compile, no errors in console, no errors in editor log, runs in editor but output log spewing
    Code (csharp):
    1. The file 'C:/[...]/mainData' is corrupted! Remove it and launch unity again![Position out of bounds! 89164 > 89160]
    and
    Code (csharp):
    1. Scene::raycastClosestShape: The maximum distance must be greater than zero!
    2. UnityEngine.Physics:INTERNAL_CALL_Internal_Raycast(Vector3, Vector3, RaycastHit, Single, Int32)
    3. UnityEngine.Physics:Internal_Raycast(Vector3, Vector3, RaycastHit, Single, Int32)
    4. UnityEngine.Physics:Raycast(Vector3, Vector3, RaycastHit, Single, Int32)
    5. UnityEngine.Physics:Raycast(Vector3, Vector3, RaycastHit, Single)
    6. Wheel:FixedUpdate() (at C:\[...]\Assets\Standard Assets\Scripts\CSharpScripts\Wheel.cs:268)
    What solved it for me in the end was actually creating a new project, and rebuilding the car from scratch. Not ideal, but now the output log is clean as can be and everything works as intended. Granted, for now with cube placeholders. I'll let you know if I run into issues with my assets. But yeah, try the solutions from the links, and if that doesn't work, it'll definitely be fixed by rebuilding it with nothing but the alternate scripts imported.

    If you need reminding- root with a Rigidbody, Carcontroller, Drivetrain, SoundController. A collider child, and a CoG. Wheel scripts on 4 children, with the meshes parented to those.

    Good luck, future people!

    Edit: Okay, here's whats happening. The bare minimum for the alternate physics model works. When I added my other scripts to the folder, the console printed 6
    Code (csharp):
    1. BCE0018: The name 'Drivetrain' does not denote a valid type ('not found').
    I assumed it has to do with the compilation order as described here, so I put the 4-5 scripts that were 'not found' into the "Plugins" folder to have them compiled beforehand, and the rest of my scripts into an outside folder.

    That made the console errors go away, but the problems in builds came back, corrupted mainData and raycasts going mad. So it's either a BCE0018 in the editor, or corrupted data in the build. What I did now was leave the few scripts in the Plugins folder, move everything else back in too, and delete any script giving out the bce0018. In my case that were Car.js, SoundToggler.js, Crashcontroller.js. None of them are used, I'm assuming they're leftovers from the arcade driving physics. With them deleted, it doesn't seem to matter where the rest of the scripts are, I do have an own script that gives the same error when in the same folder, so I pulled it outside, and it works fine. Builds are clean too.

    So basically, check your project hierarchy, pull the scripts that need compiling first into the "Standard Assets" or "Plugins" folder, and delete the scritps giving BCE0018 errors, not the scripts they can't find.
     
    Last edited: Jul 8, 2013
  13. NullSignal

    NullSignal

    Joined:
    Sep 18, 2013
    Posts:
    45
    I'm having issues using this with custom models. I'm trying to use this script for my first game (I know, jumping in over my head) and I've modeled some cars, but I can't get them to stay upright and I'm having some camera issues. I'm not worried about the camera issue so much right now as the fact that my cars don't want to level after I apply the CenterOfMass. I can get them level on the Z axis or the X axis, but never both. It always wants to tilt on either axis, no matter where I place the CenterOfMass object. Anyone else have similar issues?
     
  14. KCK360

    KCK360

    Joined:
    Feb 1, 2014
    Posts:
    1
    Ummm how do I get to the tutorial itself and how do I play the game?
     
  15. Project Zero

    Project Zero

    Joined:
    Jul 9, 2013
    Posts:
    4
    Thanks you, i just try this and work fine.
     
  16. mgfilm

    mgfilm

    Joined:
    Mar 10, 2014
    Posts:
    1
    my last minute thank you
     
  17. dvu

    dvu

    Joined:
    Aug 15, 2013
    Posts:
    29
    I successfully built it for PC., Tested it. "play" with it.
    but(!). when I tried to build for android, I got these errors.
    When I tried to remove Car.js of project, compile errors for Android is no longer taking place, the scene loaded, but nothing else happened.
    please. kelp to resolve it
     
  18. MichaelMcFarland

    MichaelMcFarland

    Joined:
    Apr 3, 2014
    Posts:
    1
    I'm not seeing the link for this project anymore. Does anyone know where it is?

    To clarify, I don't see the link for the tutorial part. I did download the project and that worked fine. But I don't see any tutorials.
     
    Last edited: May 6, 2014
  19. snakebreath

    snakebreath

    Joined:
    May 8, 2014
    Posts:
    1
    It's in the assets store category >completed projects>tutorials
     
  20. ItsAmee

    ItsAmee

    Joined:
    Nov 22, 2012
    Posts:
    11
    Hi,

    I'm enjoying the tutorial and started working through the code to understand what's happening. I very occasionally get a NaN error from this line in the UpdateDrag() function.

    rigidbody.AddForce(transform.TransformDirection(drag) * rigidbody.mass * Time.deltaTime);

    I'm presuming it's the drag and checking if it's a number first eg.
    if ( (float.IsNaN(drag.x)) && (float.IsNaN(drag.y)) && (float.IsNaN(drag.z))) // my check added since occassionally got a NaN error

    But that seems to screw the handbrake up, but I'm not sure as the handbrake doesn't seem to completely stop the car?

    If it makes a difference I'm using Unity 4.3.7

    Any suggestions welcome ;)
    Thanks,
    Andy
     
  21. adel_deli

    adel_deli

    Joined:
    Jan 2, 2015
    Posts:
    2
    I can't find this tutorial ! is that exist any longer ?

    + Yeah I can find it in assets. so, there is no video for this tutorial ?
     
  22. adel_deli

    adel_deli

    Joined:
    Jan 2, 2015
    Posts:
    2

    Hey you must save your scene, not only your project. create a folder in asset, name it Level or Scene, then file--> save scene ---> find your folder in asset folder, save it. then go back to the Project window at the Asset sub folder you can see your created folder, open it, you can see your saved scene there
     
  23. Nirav-Madhani

    Nirav-Madhani

    Joined:
    Jan 8, 2014
    Posts:
    27
    when i export it to android it shows error
     
  24. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
  25. Nirav-Madhani

    Nirav-Madhani

    Joined:
    Jan 8, 2014
    Posts:
    27
    Any way i can make it for mobile ?
     
  26. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Only by optimizing everything in it and making it mobile compatible yourself. Probably requires you to remodel the car and level to have less details.
     
  27. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    Only The C# version of the tutorial (under AlternatePhysics) works with Unity 5.

    The Javascript version of the tutorial does not work with Unity 5.

    The C# version uses its own custom wheel colliders, which are better than the Unity 4 wheel colliders, but slower than and not as capable as the Unity 5 wheel colliders.

    I believe all of the models used in the Alternate Physics C# version are low-poly and suitable for mobile, but you'll need to make a number of changes to some scripts to work on Android, in particular the CarController class.

    You'll need to replace all of the Input gathering code with code that reads from the accelerometer or input from a touch button. If your Android device is not as fast as an iPad Retina or Air, you'll also want to find another race track since it's not optimized for mobile, but not extremely high poly as to limit performance on newer devices.
     
  28. Gaming-Dudester

    Gaming-Dudester

    Joined:
    Apr 12, 2015
    Posts:
    3
    How do u download it?
     
  29. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
  30. tanvir_reza

    tanvir_reza

    Joined:
    Dec 21, 2015
    Posts:
    1
    hello, its amazing. but i have a problem. i can't run this. car is jumping jumping and jumping. its starting automatically. i'm using unity5. plz some one help me...
     
  31. avinash_unity542

    avinash_unity542

    Joined:
    Sep 28, 2018
    Posts:
    15
  32. kre2016

    kre2016

    Joined:
    May 19, 2017
    Posts:
    1
    Link to download Car Tutorial replay NOT FOUND / 404.
    if it's no longer available, please is there an alternate ?

    Thanks!
     
  33. Home_Builder

    Home_Builder

    Joined:
    Sep 26, 2020
    Posts:
    8
    I realize that this is a very old project - 2010 - Unity 2.n - I would like to try it. Can you please send me a link to the project files.