Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Kart-Racing Physics

Discussion in 'Assets and Asset Store' started by abar, Jul 23, 2014.

  1. subzer0

    subzer0

    Joined:
    Dec 10, 2010
    Posts:
    94
    Great Asset!

    How can I add a sound to the kart ?
     
  2. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    @elektronische: Well, I can't say for sure, but the centre of gravity is set artificially low, so changing the size of the wheels shouldn't make it any more likely to flip. Changing the top speed should also be fine.

    @subzer0: I would have a looping audio clip of an engine sound, and then simply alter the volume and pitch based on current mph of the kart. For a more complex sound you can overlay multiple looping sounds with different pitch and volume ranges (e.g. have sound 1 vary from pitch 0.8 at speed 0, to pitch 2.2 at top speed, and sound 2 varying from 1.1 to 1.9, or something like that).
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,796
    Hi,

    Is this working with Unity 5?
     
  4. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    I'm just in the process of updating it today. Should submit to the store over the weekend I hope.
     
    Meltdown likes this.
  5. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    That's not a bad idea, I'll see what I can do.
     
  6. BillO

    BillO

    Joined:
    Sep 26, 2010
    Posts:
    61
    How can I adjust the camera POV? I want a more "top down" view. I tried adjusting the camera, but the POV never changes in the game. Are the camera settings hard-coded in a script?
     
  7. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    On the camera you'll find a CameraController component, you'll need to adjust the offset parameter, which controls the positioning of the camera relative to the kart. It's easiest to adjust this whilst the game is running, so you can get a live preview of the camera's view.
     
  8. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    when i updated to unity 5, the kart can no longer go up slopes of anything greater than 30 degrees and the wheel colliders are going thru the ground
     
  9. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    So are you using the latest version (v1.4) of the Kart Physics?
    Unity completely changed the underlying physics implementation in Unity5, so some things might require re-tuning if you've made adjustments using Unity 4.6 or earlier. The wheel colliders definitely shouldn't be going through the ground though!

    Make sure you're on the latest version, and remember when updating it's always best to make a backup, then delete the entire KartRacingPhysics folder, so you don't get any merging problems from updating in-place.

    If it's still behaving strangely, then if you can please package up a small test scene and send it over and I'll take a look.
     
  10. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    yes deleted old, imported new. unity 5 changed so much that i just downloaded 4.6.5 and recompiled it rather than spend weeks updating to 5. the way it calculates rigidbodies and collider suspension totally messed everything up. if i set it lower to compensate for not being able to go up a steep slope, then it launches into space.
     
  11. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Yeah, the physics backend is totally new in Unity 5. It should be quite possible to get the kart behaving how you had it before but it might take a bit of re-tuning, so if you already had it nicely tuned in 4.6 it's probably better to stick with that.
     
  12. subzer0

    subzer0

    Joined:
    Dec 10, 2010
    Posts:
    94
    Is there any update on this asset ? :D
     
  13. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Not currently, are you waiting for something in particular?
     
  14. JohnDraisey

    JohnDraisey

    Joined:
    Jul 28, 2013
    Posts:
    19
    If I wanted to add a jump button to the kart controls, how could I go about doing that?
     
  15. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Have a look in the example player controller script (Example Scene/Scripts/ExamplePlayerController.cs) - it makes the kart jump when the user presses 'J'. Just adapt that to whatever you need.
     
  16. JohnDraisey

    JohnDraisey

    Joined:
    Jul 28, 2013
    Posts:
    19
    Oh it does jump! Nice, thanks! I'm going to buy it for Unity 5. Let's try this bad boy out. =D
     
  17. twomack37

    twomack37

    Joined:
    Aug 20, 2014
    Posts:
    14
    Really loving this asset, I was wondering what way you would go about adding a braking functionality?
    Right now I have an AI that is reducing thrust around tighter curves but I think active braking would be better.
    Any thoughts?

    Thanks again for a simple and more importantly fun implementation!
     
  18. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Apologies for the lack of reply - as you discovered, emailing support is definitely the faster way to get a response - I don't always get notifications for posts here for some reason.
    In case anyone else wants to know the answer, the kart thrust value includes braking forces. Braking is basically just a deceleration force, so you could write [thrust = enginePower - braking] if you wanted to calculate them separately, but braking is really just the same as having a negative enginePower.
     
  19. PhilGrealey

    PhilGrealey

    Joined:
    Aug 21, 2015
    Posts:
    1
    Look great but is there any way of implementing the ability to drift round corners like on other kart racing games rather than just reducing your speed when approaching a tight bend...?
     
  20. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Yes, you have control over the kart traction, if you lower that it will make the kart more slidey. You can also control something I call 'visual oversteer' - which rotates the model of the kart as you steer, independently of the actual physics. It's not at all physically correct, but it gives a really nice feeling of sliding through the corners.
     
  21. boromir111

    boromir111

    Joined:
    Oct 31, 2015
    Posts:
    2
    Hi! In new version of Unity, Unity 5.3, I have a problem when the car collide with a bomb. The car goes crazy when I touch them. How I can fix it?
     
  22. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Hmm, I'm not sure what change in 5.3 could be causing that. I'll take a look and see if I can reproduce the issue.
     
  23. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Ok, I've fixed the issue, obviously something changed in Unity's physics in 5.3. A new version has been submitted to the store, should be live in a few days hopefully (unless they have a large Christmas backlog, in which case in might take a little longer).
     
  24. Marito_22

    Marito_22

    Joined:
    Jan 13, 2016
    Posts:
    18
    I'm intrigued, how do you calculate it? And, you said you are using wheel colliders, are you adding them on the fly or through the editor? What's the benefit of adding them through code if the case? Thanks in advance!
     
  25. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    It's just slightly lower than the average of the 4 wheel positions - it makes the kart a bit more stable when cornering at high speed.
    The wheel colliders are set up in code, which means the parameters can be set once on the main kart controller, then they automatically get applied to each wheel - there's no chance of accidentally changing the params on just one wheel for example.

    hope that helps.
     
  26. Marito_22

    Marito_22

    Joined:
    Jan 13, 2016
    Posts:
    18
    Thank you for the answer. I'm trying to accomplish an arcade style driven vehicle reading from here and from there and Unity physics with wheel collider and so on point me in a realistic direction which I don't need. So, every piece of information is welcome. By the way, you code is fully commented? Thanks again.
     
  27. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
  28. Marito_22

    Marito_22

    Joined:
    Jan 13, 2016
    Posts:
    18
  29. Marito_22

    Marito_22

    Joined:
    Jan 13, 2016
    Posts:
    18
    I'm thinking of buying your asset... two questions:

    1) Can the vehicle drift?
    2) Does it use the wheel collider component to move, brake, manage suspension, etc?

    Thanks!
     
  30. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Yes, there's a special 'traction' parameter which controls how much the vehicle will slide - and also another parameter I call 'visual oversteer' which doesn't affect the physics, but makes the kart look like it's sliding around bends more - this can be useful to give the feeling of sliding, but still keeping the kart easy to control.

    It does use the wheel collider component internally, but that's all under the hood - they only get created at runtime.
     
  31. ErikBosman

    ErikBosman

    Joined:
    Mar 14, 2016
    Posts:
    1
    Is there in this package also drifting included, like mariokart style?
     
  32. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Yes, you have control over the kart traction, if you lower that it will make the kart more slidey. You can also control something I call 'visual oversteer' - which rotates the model of the kart as you steer, independently of the actual physics. It's not at all physically correct, but it gives a really nice feeling of sliding through the corners.
     
  33. joshcrad

    joshcrad

    Joined:
    Oct 17, 2017
    Posts:
    2
    Just bought the asset and am loving it! I'm fairly new to unity and working through some online tutorials. Do you mind explaining your process for creating the track? Thank you!
     
  34. abar

    abar

    Joined:
    Jan 12, 2014
    Posts:
    72
    Hi, the track model was created in Blender, then imported into Unity as an fbx. There's not much else to it really, there's a mesh collider on it, but no othet special settings a far as I can remember.
     
  35. joshcrad

    joshcrad

    Joined:
    Oct 17, 2017
    Posts:
    2
    Gotcha - thanks!
     
  36. carlos170586001500

    carlos170586001500

    Joined:
    Mar 2, 2015
    Posts:
    2
    Any video available?
    How does it interact with a loop?
     
  37. Nanie

    Nanie

    Joined:
    Mar 30, 2015
    Posts:
    3
    Your demo page is offline :( let me know when it gets back on, i would like to test it, thanks!
     
  38. hottabych

    hottabych

    Joined:
    Apr 18, 2015
    Posts:
    107
    hi. web demo is broken. please re-upload. i wanna take a look
     
  39. grindcorr

    grindcorr

    Joined:
    Nov 20, 2018
    Posts:
    1
    Just wondering if this works in 2018? and if you could fix the demo? Thanks!
     
  40. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Anyone using this? Looking for a web demo or video of how it looks.
     
  41. Farresto

    Farresto

    Joined:
    Jan 20, 2016
    Posts:
    9
    Demo page is still offline, so it would appear that support for this asset is no longer available.