Car Tutorial

Discussion in 'Announcements' started by antenna tree, Apr 24, 2010.

  1. drift501

    drift501

    New Member

    Joined:
    Apr 20, 2012
    Messages:
    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

    Member

    Joined:
    Jul 2, 2012
    Messages:
    93
    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

    New Member

    Joined:
    Aug 5, 2012
    Messages:
    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

    Unity Technologies

    Joined:
    Jun 2, 2009
    Messages:
    3,036
    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

    New Member

    Joined:
    Oct 6, 2012
    Messages:
    10
    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
  6. JamesArndt

    JamesArndt

    Member

    Joined:
    Dec 1, 2009
    Messages:
    1,633
  7. mutazalhawash

    mutazalhawash

    New Member

    Joined:
    Oct 18, 2012
    Messages:
    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

    New Member

    Joined:
    Apr 13, 2013
    Messages:
    2
  9. 2013GameLearner

    2013GameLearner

    New Member

    Joined:
    Apr 22, 2013
    Messages:
    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

    New Member

    Joined:
    Apr 22, 2013
    Messages:
    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

    Member

    Joined:
    Jun 8, 2013
    Messages:
    17
    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

    Member

    Joined:
    Jul 5, 2011
    Messages:
    203
    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. carnivoris

    carnivoris

    Member

    Joined:
    Sep 18, 2013
    Messages:
    3
    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

    New Member

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

    Project Zero

    New Member

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

    mgfilm

    New Member

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

    dvu

    Member

    Joined:
    Aug 15, 2013
    Messages:
    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

    New Member

    Joined:
    Apr 3, 2014
    Messages:
    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

    New Member

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

    ItsAmee

    Member

    Joined:
    Nov 22, 2012
    Messages:
    4
    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