Search Unity

Endless Car Chase Game Template

Discussion in 'Assets and Asset Store' started by puppeteer, Apr 13, 2018.

  1. RicochetWitcher

    RicochetWitcher

    Joined:
    Nov 12, 2014
    Posts:
    5
    really cool!! Waiting for the update and hope bike was added. And one more question: can I limit the drive wheels angle?
     
    puppeteer likes this.
  2. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    The angle of the front wheels is tied to the value of driftAngle so you can control it with that value, but if you want to limit the angle of the wheel without also affect the drifting angle of the car chassis you can multiply this value with another number for the limitation. ( Click on screenshot to see it larger )

    upload_2018-12-27_4-5-14.png
     
    RicochetWitcher likes this.
  3. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9
    Hi.

    First of all, amazing work you have done on the template and thanks for still supporting your product through forums and answers.

    I had a few questions but all of them is related to a city building and since you're going to add that in a new update I will wait for that :D

    but I have a request from you:
    1- Can you add left and right buttons as an addition to the touch and the wheel.
    2- Can you add IAP menu, just a menu without function code even for just the sake of it being a template.
    3- Can you add an ability to increase the car numbers the longer the time go

    Thank you.
     
    Last edited: Dec 27, 2018
    puppeteer likes this.
  4. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Thanks, I'm trying to push this update as fast as possible.

    1. Right now keyboard/gamepad you can move left/right with the A/D buttons or arrow buttons, or on mobile by touching the left side of the screen to turn left and the right side of the screen to turn right, and of course the wheel as an option. What other control method are you referring to.

    2. I'm afraid if I put some mockups for IAP in the UI it might confuse people and create expectation for an actual real cash store in the base template. But I'll think of something, maybe a canvas that can be added to the current shop to open a mockup for IAP.

    3. That's a great idea, I think I can add an over-time multiplier for the spawn rate components, and limit them to a minimum/maximum value so that it doesn't break the game balance.
     
    The0Warrior likes this.
  5. The0Warrior

    The0Warrior

    Joined:
    Nov 19, 2017
    Posts:
    9

    Thank you for your reply.

    1- Sorry I didn't make my self clear, I meant something like that

    1.JPG
    I found a way to attach them to the "playerDirection" in your script to 1 or -1 depending on the direction. It's just an extra method that I'm more comfortable with :D

    2- Awesome, thanks for considering it.
    3- cool, glad you liked the idea.
     
    puppeteer likes this.
  6. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Hello,

    Looks like a really nice template, 2 suggestions if you dont mind :
    Health : collectible health/repair to keep the game playing longer.
    Extra bonus : extra bonus in case a police car got destroyed, this will make the player try to make them crush while running around.
     
    puppeteer likes this.
  7. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    In addition to the regular cash and extra cash items, there is an item that adds to the health of the player. So this one exists in the package.

    upload_2019-1-2_20-35-8.png

    The other idea about bonus for crashing cars can be awesome, even give varying bonus for tougher enemy cars.
     
  8. Victor_S

    Victor_S

    Joined:
    Feb 5, 2015
    Posts:
    10
    Dear developer, you're awesome.
    First of all, I wish you good luck in new year.
    Next, I want to ask about new version:
    1 Do cops trying to avoid buildings and trees?
    2 Is it easy to implement bridges(both riding on top and under the bridge) in new version? See attached image - https://ibb.co/bbqP2BM. As I read this thread, car will stick to ground, will it jump if I'll try to ride bellow bridge?
    Thanks
     
    siddharth3322 and puppeteer like this.
  9. Victor_S

    Victor_S

    Joined:
    Feb 5, 2015
    Posts:
    10
    Also, can I use any custom terrain generator like Magic Map? It generates custom object and terrain as a child.
    As I read this thread I learned: I can disable floor and enable terrain and it will work automatically, is it hard to achieve this with custom terrain generator?
    Thanks again
     
    puppeteer likes this.
  10. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Wish you a successful new year too!

    1. Yes, the AI cars will try to avoid any obstacles they detect in front of them. Depending on the size of the object and the speed of the car it may not be able to detect and swerve away in time. So for that you have attributes you can control for each car:

    upload_2019-1-4_12-8-11.png

    For example, for the city cop car I increased the rotation speed ( so they react fast ), and increased the detect distance ( so they see the obstacles faster. Those red lines in front of the car are the obstacle detectors ).

    2. I don't think it's easy with the current code, the detection raycast of the ground happens from above the car and straight down, so if there is a low bridge above it will probably catch it before it catches the ground street below.

    3. The terrain demo scene uses the default unity terrain, but I think it should be fine with any other terrain as long as it has collision info ( this is how it is detected with a raycast ).
     
  11. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @puppeteer can you help me with this problem?
    https://forum.unity.com/threads/move-player-car-in-forward-direction-using-physics-force.606982

    I knew its not related to you but you have good knowledge of gaming so that I have some hope that you can help me into this. I want to move my car but using Physics because I want to use real collision detection for collision rebound purpose. Currently, I am facing a struggle with car rotation and I have recorded a short video for my gameplay too.
    Please guide me into this if become possible.
     
    puppeteer likes this.
  12. Victor_S

    Victor_S

    Joined:
    Feb 5, 2015
    Posts:
    10
    Thanks, I purchased another your asset today - Endless Zombie Racing. So far it's great
    This one will be next
    thanks
     
    puppeteer likes this.
  13. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
  14. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Wow, this is incredible!!!!!! Reminds me of a SNES game I used to play, PowerDrive, where the goal is to pass a series of driving tests.
     
    adrog6666 likes this.
  15. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    I have a really dumb question, how can I get the money text on the Game Canvas? not just on the shop canvas..
    Thanks, sorry to be annoying...
     
    puppeteer likes this.
  16. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You can directly get the total money you have from the saved PlayerPrefs:

    Code (CSharp):
    1. PlayerPrefs.GetInt("Money", 0);
    Notice that the name of the playerprefs can be changed in the shop, by default it's "Money" but you can replace it with other values, so I think the best thing is to get the money directly from the ECCShop script in the scene when starting the game, like this:

    Code (CSharp):
    1. PlayerPrefs.GetInt(GameObject.FindObjectOfType<ECCShop>().moneyPlayerprefs, 0);
    Then you can put it of course in a moneyText object like we put the score in a scoreText object in the game canvas.
     
    adrog6666 likes this.
  17. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Update 1.20 is live on the store, go chase it!



    https://www.assetstore.unity3d.com/#!/content/116027?aid=1011lGiL

    Update 1.20 (28.12.2018)
    - Added city demo scene with buildings, streets, trees, etc.
    - Added spawning script that creates objects at certain points, closest to the player.
    - Added two bike models, one of them with a turning handlebar.
    - Option to make AI cars chase other cars periodically, for some extra chaos!
    - Fixed mobile controls and removed unused assets.
     
    RicochetWitcher and The0Warrior like this.
  18. Yaromil

    Yaromil

    Joined:
    Jan 13, 2019
    Posts:
    2
    Hey i just bought the game and i think it's really well made. I have one question thought, where can i find the documentation and where can we contact support for additional info ?
     
    puppeteer likes this.
  19. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You can find the documentation file in the assets folder when you import the project, there is a PDF and Word versions.

    You can contact me through mail (puppeteerint@gmail.com),
    twitter (https://twitter.com/PuppeteerInt),
    facebook (https://www.facebook.com/PuppeteerInt/?ref=bookmarks),
    instagram (https://www.instagram.com/majdabdulqadir/)

    Or here on the forums where you can share your feedback and suggestions with others, it's good for the entire community.
     
    Yaromil likes this.
  20. rwanim8or

    rwanim8or

    Joined:
    Jan 22, 2017
    Posts:
    18
    Having a lot of fun with this kit. Started a VR project with it!
     
    alienorbit, Xain, Yaromil and 3 others like this.
  21. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Wow awesome work! Love the integration of the UI into the car. How is performance in VR?
     
  22. rwanim8or

    rwanim8or

    Joined:
    Jan 22, 2017
    Posts:
    18
    It's great, no hiccups. Only strain is the huge city I put in, and this is on a mobile VR headset
     
    puppeteer likes this.
  23. Yaromil

    Yaromil

    Joined:
    Jan 13, 2019
    Posts:
    2
    You almost cannot recognize the template if you don't see the coins from the original one. Also i find the city scene really well designed, are the assets open source ?
     
    puppeteer likes this.
  24. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Looking at getting this and was wondering a couple things.

    I see the character moves forward constantly, anyway to make it so the car can come to a stop when a key/direction is not being pressed?

    Using a gamepad, I have the need for the car to move the direction the joystick is pointing, not the default left/right steering movement. Do you think this will be easy to integrate?

    How does the car handle ramps? Specifically leaving ramps? or hanging off of a ramp/cliff edge? I downloaded and played the demo and it was on a flat surface so couldn't check this. Knowing this isn't a normal car controller I'd like to know if it will react how I need it to.

    Thank you!
     
    siddharth3322 and puppeteer like this.
  25. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I'll make a few tests to see how directional controls can work, basically in the game you tell the car where to go ( position ), and it rotates to the correct direction, so if we translate this to direction logic I would probably make a pointer around the car position that changes in X and Y based on gamepad input ( Horizontal/Vertical ), and the car will try to go in that direction based on its rotation and move speed.

    About physics, this isn't that type of car handling, so you'll see that the car is aligned to the floor at all times. I have a hidden code that allows the car to drop slowly if it's above ground instead of attached to all surfaces, but it doesn't look as good as a true physics simulated car.
     
  26. jaugusto

    jaugusto

    Joined:
    Aug 29, 2016
    Posts:
    11
  27. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
  28. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    @maxaud Here's my first test for directional controls, the car will rotate to one of 8 directions based on user input. User input is also tied to the car speed, so if we don't press anything the car will slowly stop, and if we press any directional button it will speed up again.

    ECCDirectionalControls.gif

    It still needs more modifications to make it work correctly with previous control schemes, but it's a start.
     
  29. hasancansolakoglu

    hasancansolakoglu

    Joined:
    Feb 22, 2019
    Posts:
    1
    can i add weapons to car?
     
    puppeteer likes this.
  30. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You'd have to code it of course, but I don't think it's hard to do.
    Basically, set a weaponMuzzle and weaponShot variables in each Car class.

    Then do some basic shooting code in the car like this:

    Code (CSharp):
    1. if ( Input.GetButtonDown("Fire1") )
    2. {
    3.     Instantiate(weaponShot, weaponMuzzle.position, weaponMuzzle.rotation);
    4. }
    Then set the class of the Shot to have variables for shotDamage and moveSpeed, and move it as a transform or a rigidbody like this:

    Code (CSharp):
    1. transform.Translate(Vector3.forward, Space.Self);
    And for collision you can apply the damage on trigger enter with the enemy cars.
     
    cryptokayser likes this.
  31. Konnect

    Konnect

    Joined:
    Aug 13, 2018
    Posts:
    5
    Hey there, hope you're fine.
    Is there any solution to fix this rear wheels uplift issue.
    thanks in advance :)
     

    Attached Files:

    • ecc.png
      ecc.png
      File size:
      672.8 KB
      Views:
      717
    puppeteer and cryptokayser like this.
  32. imanbasri

    imanbasri

    Joined:
    Mar 25, 2019
    Posts:
    16
    hi i cant use wheel coliiders please help me
     
  33. imanbasri

    imanbasri

    Joined:
    Mar 25, 2019
    Posts:
    16
    how us wheel cooliiders
     

    Attached Files:

    • sasa.png
      sasa.png
      File size:
      386.2 KB
      Views:
      708
  34. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    This is a quirk related to the calculation of the car base when moving along terrain. It depends on the distance of the forward point the car is looking at. Right now it's about 5 points, so to make up for it this take a look inside ECCCar near the end at line 500 where it has the LookAt code, and add this:

    Code (CSharp):
    1.             thisTransform.Find("Base").localEulerAngles += Vector3.right * -5;
    2.  

    upload_2019-4-6_15-28-8.png
     
    Konnect likes this.
  35. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Hi, there is no use for wheel colliders in the game. Cars move along terrain surface using a Raycast. Is that what you are trying to achieve?

    In that case give your terrain object a Layer name that is the same as in the GameController, like this:

    upload_2019-4-6_15-31-57.png

    and

    upload_2019-4-6_15-32-12.png
     
  36. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Update 1.25 is live on the store, check it out!



    https://www.assetstore.unity3d.com/#!/content/116027?aid=1011lGiL

    Update 1.25 (10.04.2018)
    - Option to toggle Direction Controls for keyboard/gamepad, which makes the car move in the direction of the input (left/right/up/down/diagonal), instead of rotating left/right only.
    - Minor scene updates and fixes.
     
    ocimpean likes this.
  37. imanbasri

    imanbasri

    Joined:
    Mar 25, 2019
    Posts:
    16
    how can use as trail renderer Endless Car Chase Game Template
     
    puppeteer likes this.
  38. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    Does work as well on mobile? left, right ?
     
    puppeteer likes this.
  39. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    On mobile it works with a UI steering wheel that you can turn to steer the car, but if you remove the steering wheel object from the scene it works by tapping on the left/right sides of the screen, and it keeps moving constantly.
     
  40. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You can add a Trail Renderer in an empty object inside the chassis of the car and with a bit of tweaking it should work well.

    upload_2019-7-12_23-34-26.png
     
  41. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    okay, is it easy to add a speed boost to the item script?
    I want to add a pickup, that gives the player car a speedboost for a couple of seconds.
    Thanks
     
    puppeteer likes this.
  42. imanbasri

    imanbasri

    Joined:
    Mar 25, 2019
    Posts:
    16
    hi - How can I use it SKIDS MARKS ?
     
    puppeteer likes this.
  43. borjanews

    borjanews

    Joined:
    Feb 27, 2017
    Posts:
    11
    How i can put physics to jump stunts or ramps? i has tested by myself but the cars has glue with the terrain
     
    puppeteer likes this.
  44. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You can use the skid marks from the Coupe Car. Activate them, and then set them to Transform Z, and rotate them to 90 in X axis, like this screenshot:

    upload_2019-7-17_22-6-40.png
     
  45. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Yes, in this package the car doesn't use physics for controls, it only aligns to the surface using Raycast. To make it behave physically will need to change the core of the car code.
     
  46. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    The ECCItem script allows you to target other objects by tag and then run a function from those objects. For example the cash targets the GameController tag and runs the function ChangeScore when picked up.

    In the same way you can create a function that increases the player speed and then target it using ECCItem.
     
    adrog6666 likes this.
  47. borjanews

    borjanews

    Joined:
    Feb 27, 2017
    Posts:
    11
    Any help of how i can do it?
     
  48. imanbasri

    imanbasri

    Joined:
    Mar 25, 2019
    Posts:
    16
    is not work
     

    Attached Files:

  49. imanbasri

    imanbasri

    Joined:
    Mar 25, 2019
    Posts:
    16
    skid marks is not destroy
     
  50. imanbasri

    imanbasri

    Joined:
    Mar 25, 2019
    Posts:
    16
    look
     

    Attached Files:

    • sss.png
      sss.png
      File size:
      367.6 KB
      Views:
      602
    puppeteer likes this.