Car Tutorial for Android

Discussion in 'Android Development' started by Vancete, Mar 21, 2012.

  1. Vancete

    Vancete

    Member

    Joined:
    May 3, 2010
    Messages:
    66
    I'm trying to port Car Tutorial to Android, but when I switch the platform to Android, I get a lot of errors.
    Is there the Car Tutorial ported over the forum?
    Thanks and sorry for my bad english:D
     
  2. TeotiGraphix

    TeotiGraphix

    Member

    Joined:
    Jan 11, 2011
    Messages:
    128
    The Car tutorial is very complicated. I doubt just changing the build to Android you are even going to get close to running that game.

    One, you need to figure out how you are going to deail with Input, Two any javascripts need to have #pragma strict to enable strict compiling for performance (this could mean a bunch of refactoring). Three, who knows what other errors come up after you have managed to kill the first two batches.

    Mike
     
  3. tigerfoot

    tigerfoot

    New Member

    Joined:
    Nov 2, 2009
    Messages:
    132
    It is much easier to port Andrew Gotow's car tutorial. All i had to change was the input method if i remember correctly.
     
  4. TeotiGraphix

    TeotiGraphix

    Member

    Joined:
    Jan 11, 2011
    Messages:
    128
    Do you have a link for that?

    Mike
     
  5. tigerfoot

    tigerfoot

    New Member

    Joined:
    Nov 2, 2009
    Messages:
    132
    Here. I dont have my laptop with me (my ported version is there)

    Change this part of code:
    Code (csharp):
    1.  
    2. // finally, apply the values to the wheels. The torque applied is divided by the current gear, and
    3.     // multiplied by the user input variable.
    4.     FrontLeftWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * Input.GetAxis("Vertical");
    5.     FrontRightWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * Input.GetAxis("Vertical");
    6.        
    7.     // the steer angle is an arbitrary value multiplied by the user input.
    8.     FrontLeftWheel.steerAngle = 10 * Input.GetAxis("Horizontal");
    9.     FrontRightWheel.steerAngle = 10 * Input.GetAxis("Horizontal");
    10.  
    Change Input.GetAxis with Input.acceleration, and that should be it.
     
  6. Phong

    Phong

    Member

    Joined:
    Apr 12, 2010
    Messages:
    482
    I am working on a racing game for iOS and started with the car Tutorial. I got it to work, but with MAJOR changes. I wouldn't recommend this approach. If I were doing it again I wouldn't do this. Try one of the car packages in the asset store.
     
  7. jessica1986

    jessica1986

    Member

    Joined:
    Feb 7, 2012
    Messages:
    600
    When I changed to Input.acceleration.x and same for y.....while exporting it to android 10 errors for SmoothFollow.js is coming 'unknown identifier' for many variables
     
    Last edited: Apr 2, 2012
  8. augasur

    augasur

    Member

    Joined:
    Mar 4, 2012
    Messages:
    133
  9. jessica1986

    jessica1986

    Member

    Joined:
    Feb 7, 2012
    Messages:
    600
    Im lookin out for the solution to my problem
     
  10. jessica1986

    jessica1986

    Member

    Joined:
    Feb 7, 2012
    Messages:
    600
    can any1 help me on dis
     
  11. TeotiGraphix

    TeotiGraphix

    Member

    Joined:
    Jan 11, 2011
    Messages:
    128
    This probably means that you don't have variables by type defined in the script scope.

    Can you post the lines of code that are throwing the error?

    Mike
     
  12. arshiyan

    arshiyan

    New Member

    Joined:
    Aug 24, 2009
    Messages:
    8
    remove SmoothFollow.js and import scripts package again
     
  13. tigerfoot

    tigerfoot

    New Member

    Joined:
    Nov 2, 2009
    Messages:
    132
    add "var" in front of those undefined variables in SmoothFollow.js and it wont give you any errors.