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. Dismiss Notice

Powerslide Kart Physics – Drift, jump, and boost with classic kart mechanics

Discussion in 'Assets and Asset Store' started by JustInvoke, Oct 5, 2019.

  1. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Youtube Thumb.png

    WebGL Demo | Windows Demo | Android AI Demo | Documentation | Support Email

    This is the most straightforward solution for achieving smooth, responsive kart physics. Familiar mechanics including jumping, drifting, and turbo boosting are all here, along with limited item/powerup support and basic waypoint AI.

    Three common boost modes are featured, including Drift Auto, Drift Manual, and Manual.

    Drift Auto is the most common kind, rewarding karts with boost following successful drifts. Boost amount given is indicated by sparks coming from the rear wheels.

    Drift Manual is a little more technical, requiring the press of a secondary button once the boost meter has filled to a certain amount, but not all the way. The drift meter fills while drifting, and several boosts can be performed during a single drift.

    Manual is the most simple type, acting like standard boost in racing games with a typical boost meter. Drifting fills up the meter, but boost can be used any time by holding down the boost button.

    This asset supports two item types out of the box: projectile items and turbo items. Four example items are included, these being the trap, bouncer, homing item, and turbo boost.

    Rudimentary waypoint-following AI is included, but this is mainly for demonstration purposes.

    The PDF documentation contains a walkthrough for setting up a kart from scratch as well as a script reference for users interested in expanding upon the asset.

    Try out either the WebGL or Windows demo to see how the karts feel for yourself. There is also an AI-controlled demo for Android meant to demonstrate performance.

    For inquiries and assistance, reach out for support by email to justin@justinvoke.com. Customers are asked to submit an invoice number from purchase when contacting for technical support.

    Purchase on the Asset Store – $50 USD

     
  2. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    410
    Hey guys, weird that no one has been responding to this thread. This asset is the spiritual successor to Randomation, but more polished and even better playing. As a fan of the first randomation (for Unity 4) i'll be getting this one for sure!
    Thanks for the great work JustInvoke.
     
    JustInvoke likes this.
  3. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Thanks, it means a lot that you've continued to follow my work all these years.
     
    nukeD likes this.
  4. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    410
    ... and i got it, i'm expecting to really use it for my next game!
     
    JustInvoke likes this.
  5. davidwhiffen

    davidwhiffen

    Joined:
    Sep 26, 2019
    Posts:
    14
    I really love this asset! It is pretty easy to use and well thought out.

    I do have a question.. How do I add multiple player karts with controller support?
     
  6. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    For local multiplayer, it depends on what input system you're using. Generally you will have to do some coding to create a subclass of the KartInput class, such as KartInputPlayer and BasicWaypointFollower. Both of these subclasses set input variables of the inherited class that are automatically sent to the main Kart class. KartInputPlayer is the most basic example and sets input directly based on axes that are set up in Unity's input manager.

    If you are using Unity's input manager to manage axes corresponding to each player's input, you can make some small adjustments to the KartInputPlayer script to fetch certain axes based on the player index/number. If you are using an asset such as Rewired or InControl, you will have to create a script to connect them to karts, basically fetching input from whatever asset you're using.

    If you offer some more details on how you're handling input I can assist a bit with designing an input class that works for you. I will help with connecting my asset to any input system, but will not troubleshoot issues stemming directly from other assets.

    Next to input, you obviously need to have multiple cameras to follow each kart. You can make some small modifications to the KartCamera script to fetch input from each player's controller since the script is hardcoded to use the input manager for the sake of simplicity. You should be able to just set the targetKart variable to whichever kart a given camera should follow, then call the Initialize function in the script.

    I chose not to include multiplayer support out of the box because there are a lot of aspects that can vary depending on how a developer's project is set up and working with multiple controllers in Unity can be finicky. It also makes it so that I effectively have to troubleshoot any issues that users face with their given input system even if the problem may be directly caused by their implementation and not my asset. Then you have the camera and audio setup which can be tricky with how Unity only allows one active audio listener at a time.

    Right now I don't have concrete plans for multiplayer since I'm a student and am not in a position where I can commit to this this level of troubleshooting. Online multiplayer may actually be simpler since that mainly just involves syncing the positions and rotations of other karts while maintaining the same local input, camera, and audio configurations.
     
  7. davidwhiffen

    davidwhiffen

    Joined:
    Sep 26, 2019
    Posts:
    14
    Awesome. We're going to give it a try tomorrow with our buddy who's more familiar with writing code with Rewired than we are. Will let you know.
     
  8. davidwhiffen

    davidwhiffen

    Joined:
    Sep 26, 2019
    Posts:
    14
    Fair enough. What should the script I write say to get Rewired to work with this?

    I had our programmer take a look and he wanted me to ask you.
     
  9. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    It depends on how Rewired works, but I haven't used it. I'm guessing Rewired either has public variables related to input that you can use or some kind of event system that sends input values to specific functions on a script (kind of like the events on some of the scripts in this asset).

    If you are just fetching public variables from Rewired, you can make some simple changes to the default input script:
    Code (CSharp):
    1. public class KartInputPlayer : KartInput
    2. {
    3.     public override void Update()
    4.     {
    5.         targetAccel = InputManager.accelInput; //Change this to fetch from your "accel" input in Rewired (float)
    6.         targetBrake = InputManager.brakeInput; //Change this to fetch from your "brake" input in Rewired (float)
    7.         targetSteer = InputManager.steerInput; //Change this to fetch from your "steer" input in Rewired (float)
    8.         drifting = InputManager.driftButton; //Change this to fetch from your "drift" input in Rewired (bool)
    9.         boosting = InputManager.boostButton; //Change this to fetch from your "boost" input in Rewired (bool)
    10.  
    11.         //The item button press input is a little different since it depends on the
    12.         //item input source being true for exactly one frame. If rewired has some
    13.         //kind of property like "button pressed" you can fetch it here (bool)
    14.         if (InputManager.itemButtonDown)
    15.         {
    16.             PressItem();
    17.         }
    18.  
    19.         base.Update();
    20.     }
    21. }
    If Rewired is more event-driven then you could have functions for setting each type of input:
    Code (CSharp):
    1. public class KartInputPlayer : KartInput
    2. {
    3.     public void SetAccel(float accel)
    4.     {
    5.         targetAccel = accel;
    6.     }
    7.  
    8.     public void SetBrake(float brake)
    9.     {
    10.         targetBrake = brake;
    11.     }
    12.  
    13.     public void SetSteer(float steer)
    14.     {
    15.         targetSteer = steer;
    16.     }
    17.  
    18.     public void SetDrift(bool drift)
    19.     {
    20.         drifting = drift;
    21.     }
    22.  
    23.     public void SetBoost(bool boost)
    24.     {
    25.         boosting = boost;
    26.     }
    27.  
    28.     //There is also an inherited PressItem function for using items that
    29.     //can be called but it is marked as protected and can be changed
    30.     //to public (in the KartInput script)
    31. }
    The variables that are being set such as "targetAccel" are inherited from the KartInput class and are automatically sent to the kart that the script is attached to.
     
  10. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,548
    Rewired does have a free trial version available if you want to take a closer look at it.

    https://guavaman.com/projects/rewired/trial.html

    Based on what you have posted it should be very easy to support rewired. I have used it with other car racing assets that did not have direct support.

    replace this ...

    Code (CSharp):
    1. boosting = InputManager.boostButton; //Change this to fetch from your "boost" input in Rewired (bool)
    2.  
    with something like this ...

    Code (CSharp):
    1. boosting = Rewiredplayer.GetButton("boost");
    2.  
    Here is a simple example of Rewired setup and code to get a general idea.

    https://forum.unity.com/threads/can...ship-or-aircraft-cockpit.455223/#post-2957041
     
    Last edited: Dec 8, 2019
    JustInvoke likes this.
  11. davidwhiffen

    davidwhiffen

    Joined:
    Sep 26, 2019
    Posts:
    14
    I'll give this a try today! Thanks!
     
  12. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    410
    I'm using rewired too, so Justin if you could have a look at it and share some knowledge it would be most awesome.
     
  13. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Ok, over the next week I'll take a look at it and maybe work on a guide for integration.
     
    nukeD likes this.
  14. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    I downloaded the trial version of Rewired and used the quick start guide to set it up.

    I made some small changes to the original kart input script to fetch input based on Rewired actions. Just replace the KartInputPlayer script with this new one on the root transform of a kart and it should work. The player ID and action names can be set in the inspector to match those in your Rewired configuration. Instead of copying and pasting the script, you can also download the version attached to this post.

    Let me know if it provides enough information to get your project working with Rewired.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Rewired;
    4.  
    5. namespace PowerslideKartPhysics
    6. {
    7.     //This class controls a kart with Rewired input
    8.     public class KartInputPlayerRewired : KartInput
    9.     {
    10.         public int playerId = 0;
    11.         Player player;
    12.  
    13.         public string accelAction;
    14.         public string brakeAction;
    15.         public string steerAction;
    16.         public string driftAction;
    17.         public string boostAction;
    18.         public string itemAction;
    19.  
    20.         //Initialize Rewired input
    21.         public override void Awake()
    22.         {
    23.             base.Awake();
    24.             player = ReInput.players.GetPlayer(playerId);
    25.         }
    26.  
    27.         public override void Update()
    28.         {
    29.             //Set kart input based on Rewired input
    30.             targetAccel = player.GetAxis(accelAction);
    31.             targetBrake = player.GetAxis(brakeAction);
    32.             targetSteer = player.GetAxis(steerAction);
    33.             drifting = player.GetButton(driftAction);
    34.             boosting = player.GetButton(boostAction);
    35.  
    36.             if (player.GetButtonDown(itemAction))
    37.             {
    38.                 PressItem();
    39.             }
    40.  
    41.             base.Update();
    42.         }
    43.     }
    44. }
     

    Attached Files:

  15. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    410
    Hey Justin, thanks a lot i'll test it as soon as i get the chance (real life got to me these past holiday weeks).
     
    Last edited: Dec 21, 2019
  16. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,797
    Does this have a greatly improved suspension over Randomation for going over bumps and jumps, or will this only work well for smooth/flat surfaces?

    The biggest problem I had with Randomation was I just could never get the suspension working well for my game's offroad tracks.
     
  17. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    The suspension is a bit simpler actually and not necessarily better for dealing with uneven terrain. Another important aspect is how the karts rotate, as it's handled by rotating the transform directly while the rigidbody rotation is restricted. The rotation rate can be adjusted and karts rotate based on the average ground normal of the wheels.
     
    nukeD likes this.
  18. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    410
    Yey! Thanks man!
     
    JustInvoke likes this.
  19. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Version 1.03 has been released with the following changes:
    • Added new Demo Mobile scene containing UI buttons for mobile input. A new KartInputMobile class has been added and applied to a new set of kart prefabs for fetching mobile input. The InputManager class has also been updated with new functions and a struct for setting mobile input. See the documentation for details with a new section titled Mobile Input on page 30.
    • Added new "airDriveFriction" variable to the Kart class to adjust how karts can accelerate and brake while airborne.
    • Updated copyright year in all scripts to 2021.
    • Unnecessary package dependencies have been removed.
    Some customers have expressed interest in a kart racer game kit with features like race logic, lap counting, more sophisticated track waypoints, split screen, etc. and I might develop something like that in the distant future (no sooner than this coming summer). These features would be in a separate, more expensive asset with the ability to upgrade from this one for the price difference.

    I still have a rough list of things I want to add to this asset, such as an official way to integrate it with online multiplayer systems and waypoints allowing multiple connections. Maybe better engine sounds like gear simulation too. I had some other ideas for small changes but they're escaping me at the moment. Right now I can't work on it too much because of school commitments.
     
    lukasynthetic, nukeD and tricagames like this.
  20. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    410
    Great work so far man!!
    That's fair enough! I'll get it for sure.
     
    JustInvoke likes this.
  21. AMDonline

    AMDonline

    Joined:
    Dec 12, 2013
    Posts:
    7
    Greetings everyone

    Am the producer of a commercial game project that uses this amazing asset.
    The main programmer in the project is seeking guidance on a physics issue we faced, this is his message:

    Hi there! I'm working on a game for a client that uses Powerslide Kart Physics. One of the requests has stumped me a little and I'm looking for guidance if anybody can offer some.

    What I need to do, is make karts that collide with one another repel each other slightly, to emulate rebounds. I basically have to replace the concept of trading paint with the concept of slightly bumping off of one another. However, the bumps cannot cause excessive additions of velocity, both in positive and in negative. For instance, I cannot have a car bumping one in front of it being slowed down too much, or the car in front benefitting from a large acceleration. Side collisions are generally more acceptable, but they can lead to horrible situations when there are 3 cars beside one another...

    I have already tried changing physics materials, with excessive results in edge cases, with cars flying all over the place. I've tried adding artificial velocities, but again, edge cases of numerous vehicles beside one another leading to extreme results. I need something subtle enough that it doesn't disrupt the racing, yet visible enough that the player can notice it at a glance.

    Does anybody have any suggestions as to what the correct approach would be to obtain a result that more or less matches my description? Any guidance would be appreciated.


    footage of the gameplay and a reveals part of the issues (cars stuck to each other):

     
    Last edited: Feb 15, 2021
    xploreygames likes this.
  22. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    I sent this as a reply to your email as well:
    I think this could be a useful feature for everyone, so at some point I'll officially add it to the package at a later date.
     
  23. shininguri

    shininguri

    Joined:
    Nov 25, 2015
    Posts:
    27
    Hi i was looking into buying a drift system and applying it to a game where you fly in a jet instead or driving a car. So my question is would i be able to easily create a vehicle without wheels and still have the drift physics apply? The forward thrust of the jet will be handled by a rail script similar to star fox. Do you think this is achievable with your asset?
     
  24. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    I think this asset is overkill for that if all you need is drift physics for a jet. You don't even need all the wheel and ground collision stuff and it would be difficult to extract the drifting part. If the jet is rather hovering over the ground rather than flying high in the air then it could possibly work. Could you give a more precise description of the behavior?
     
  25. shininguri

    shininguri

    Joined:
    Nov 25, 2015
    Posts:
    27
    Yeah it probably is honestly lol. Im just trying to find the simplest way to tack on a drift mode to my starfox like movement. The ship doesnt hover over the ground though which i figured would be a problem as most drift tutorial info is based on having wheels. So i figured maybe extracting code from an asset would be easier. Especially this one as you already have a boost mechanic set up.
     
  26. HunterDad-HD

    HunterDad-HD

    Joined:
    Apr 12, 2021
    Posts:
    2
    Hey Justin, nice work here man... I like it... One question... I am building a VRChat worlld and would like to know if this is compatible with the VRC SDK.
     
  27. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    It appears that the VRC SDK requires Unity 2018.4.20, but this asset only supports Unity 2019.2.19 or later, so I don't think it will be compatible.
     
  28. ProwlerRock

    ProwlerRock

    Joined:
    May 21, 2014
    Posts:
    2
    Hi congrats! this is amazing! I have a question. Can I add extra functionality to the cars physics programmatically?
     
  29. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Thanks, you can add whatever you want since everything is implemented in C# scripts (no DLLs).
     
    nukeD likes this.
  30. shahzaib

    shahzaib

    Joined:
    Dec 14, 2013
    Posts:
    32
    hey @JustInvoke,

    thanks for the asset, it looks wonderful! I need some info before making a purchase, I'm looking for a solution that handles collisions properly with actual colliders not using ray cast.

    does your asset use Unity's standard wheel colliders or implement its own ray-based wheel colliders? I'm interested in buying this kit if it does neither of those and either implements a shape-based volumetric wheel collider using Unity's primitive collider components or by doing shape-casting.

    I had some success with my own custom solution but don't have time to work out its quarks and now looking for a more robust solution that handles collisions properly.

     
  31. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    This asset just uses basic raycasts and custom force applications to drive the karts, nothing fancy or suitable for something like in the video.

    As a side note I've been building a bike physics system with 3D wheels in Unreal for a freelance project and had success using a series of raycasts fanning out in a circle from the wheel center then applying forces to keep the wheel from intersecting surfaces. Making the wheels have some thickness would be more complex since you would need to have a couple different fans of raycasts to cover the corners of the tires. I don't have a solution for you but that's just the approach I would recommend.

    I would be reluctant to try actual hard colliders unless they're separate rigidbodies connected by joints, but getting those to behave consistently can be tricky.
     
  32. shahzaib

    shahzaib

    Joined:
    Dec 14, 2013
    Posts:
    32
    @JustInvoke, yup. this is what I'm doing, wheels are seperate rigidbodies with collider connected via hinge-joints to control motor, they feel great because they are actual rigidbodies and work/react to collisions as a rigidbody should, it is pretty satisfying for some reasons.

    only problem? they are not consistent, they slip a lot, joints feel jello and wheels wobble a lot due to joints, tried mitigating this issue with physics tick rate (Fixed Delta Time) but that obviously can only do so much.

    imho, the problem with fanning raycasts is that you will need to do more and more raycasts for big wheels and even with a higher number of raycasts, you may just not get it to work against small objects.

    Thanks for the tip, though, I might just throw my head down someday and end up implementing custom friction and forces instead of relying on joints alone.

    I really appreciate your time and valuable suggestions. :)

    thanks again.
     
    JustInvoke likes this.
  33. Gathrey

    Gathrey

    Joined:
    Apr 7, 2017
    Posts:
    1
    Hey @JustInvoke
    This asset looks amazing, I played the demo and really love the physics and how the kart movement feels, Great Job!
    I'm planning on buying it, but need to know if there is functionality to allow the karts to go up the 360 ramp without having to gain speed.
    essentially allowing physics similar to that in Mario Kart - rainbow road. (where tracks twist) without the car falling off the track.
     
  34. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Thanks, I do plan on adding custom gravity/track "sticking" in the next update as some users have requested it before. I plan to release a new update by the end of the year.

    On another note I will probably add some race features like lap counting and finishing/starting races in another update next year. Earlier in the thread I mentioned putting these in a separate paid upgrade but I don't feel that's really necessary anymore. I might increase the price a bit, but obviously current customers would not have to pay more.
     
  35. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    410
    congrats on the 1.04 update!
    Thank you!
     
  36. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    You're welcome, I forgot to post the patch notes here:
    • Added new gravity variables to the Kart class enabling custom gravity and sticking to surfaces. (See them inside the Gravity foldout in the inspector and read the Custom Gravity section in the manual on page 12.) This also includes a new preset type for kart gravity called KartGravityPreset. The "gravityAdd" variable has been moved from KartJumpPreset to KartGravityPreset.
    • Added new gravity variables to the SpawnedProjectileItem class and enabled smoothly moving on walls.
    • The ItemCastProperties struct has a new variable "castGravity" to allow items to inherit kart gravity.
    • Added "rollWithKart" and "rollSmoothRate" variables to the KartCamera class allowing the camera to roll upside-down with karts.
    • Added new KartBump class to allow karts to bump off of each other upon colliding.
    • Added "dontInvertSteerReverseAccel" variable to the Kart class to allow karts to not have inverted steering while reversing and accelerating. This is enabled by default.
    • Added lower bounds on variables in division operations to prevent division by zero errors. These are variables that would not be set to zero in the first place.
    • Reformatted all scripts to not have every brace on its own line and updated copyright year on all scripts to 2022.
    I started a new full-time job recently so updates may be even more sparse in the future (previously I was freelancing), but whenever I do get around to it I do intend to add the long-promised race features.
     
    lukasynthetic, nukeD and tricagames like this.
  37. Bluelight413

    Bluelight413

    Joined:
    Feb 8, 2018
    Posts:
    8
    Hello, this package looks amazing!

    I have a question before purchasing. There's an effect I'd like to achieve with the suspension, where the kart tilts as you accelerate and brake, just like a real life car.

    You can see an example at the timestamp 3:58 in this video: https://m.youtube.com/watch?v=LG1CtlFRmpU&list=PLaI0Ihu7KzA72nBTa7HAx7G5J1VBE-76O&

    Is it possible to achieve this effect with this package, either by tweaking values, modifying the code, or adjusting the center of mass? (The video does the latter at timestamp 3:50 to achieve the tilting effect.)
     
  38. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Yes, there is already a variable named accelTiltAmount that achieves this and another named turnTiltAmount for tilting while turning, both under the Steer foldout in the inspector. Tilting like this is artificial and cosmetic as it rotates the visual transform in local space rather than the actual rigidbody.
     
  39. Bluelight413

    Bluelight413

    Joined:
    Feb 8, 2018
    Posts:
    8
    Nice!

    With these variables turned up, I've noticed that the wheels usually follow the kart's rotation, like how it does a wheelie when accelerating and braking. If I have the car reverse from standing still, just the body rotates while the wheels stay on the ground, which is the effect I'd like to achieve. Is there a way to make just the body respond to the accelTiltAmount and turnTiltAmount variables while having the wheels ignore them?
     
  40. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    I think you would have to increase the suspension distance on the individual wheels (KartWheel script), since naturally if one end of the car lifts up higher than the suspension extends, the wheels on that end will lift up.
     
  41. Bluelight413

    Bluelight413

    Joined:
    Feb 8, 2018
    Posts:
    8
    Alright, thanks for the help!
     
  42. codecastle

    codecastle

    Joined:
    Nov 7, 2020
    Posts:
    1
    This Script for ReWired did not work for me. I replaced all of the variables with the ones I used for ReWired on the script you said to replace. Is there anyway you could help me out?

    When I replaced the script with your new one I couldn't move at all and my input was only moving the camera view around.

    Thanks in advance!
    @JustInvoke
     
    Last edited: Feb 5, 2022
  43. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    I replied to your email but am posting again here for others to see. Your issue was likely due to copying and pasting the code into KartInputPlayer.cs instead of a new script KartInputPlayerRewired.cs. If the filename and Monobehaviour class name are different then it won't show up correctly in the inspector.
     
  44. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    Version 1.05 has been released with the following changes:
    • Added support for the Input System Package with new prefab and demo scene variants. See the Input System section in the manual on page 31 for info on setting up karts with the Input System.
    • See the "Demo (Input System)" and "Demo Mobile (Input System)" scenes. New prefabs can be found in the Prefabs > Karts > InputSystem and Prefabs > Scene folders.
    • Garbage collection has been reduced in a number of scripts: Kart, KartEffects, KartBump, SpawnedProjectileItem, and TireMarkMaker.
    • Added new "maxCollisionContactPoints" variable to the Kart class indicating the maximum contact points that can be evaluated in OnCollisionEnter and OnCollisionStay. This cannot be changed at runtime, for optimization purposes.
    • Added new "canDriftInAir" variable to the Kart class to enable or disable drifting while airborne after starting a drift while grounded.
    • The "maxWheelCastHits" variable on the Kart class can no longer be changed at runtime, for optimization purposes.
    • The package now requires Unity 2019.3.0f6 or later due to optimizations to TireMarkMaker utilizing Mesh.SetVertices/Triangles/UVs/Colors calls.
     
    lukasynthetic likes this.
  45. AaronKB

    AaronKB

    Joined:
    Aug 16, 2019
    Posts:
    27
    Hi there. We are looking to use your asset (We have already purchased) for an upcoming title but the game will be server-authoritative multiplayer networked. Do you have any documentation, or best practices on getting the asset to perform over the network? Things like spawning and syncing the visual holders, wheels etc *should* be able to be handled with normal network-spawned objects (By adding network object and network transform components), however logic around the audio, tire marks etc won't be so easy from what I can tell as that all relies on internal state, some of which is private (e.g. speed).

    So I am after any guidance on how to approach this? For instance, should we look for state that's used, change the code to make it public, alter the values and then things should work? If so, is this even a reasonable thing to attempt.

    Thanks
     
  46. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    I don't have any solid guidance since I haven't tried to make this work in an online multiplayer setting, but syncing a bunch of state variables might be overkill. Maybe you could stick with network objects for important things and leave cosmetic things like particles and audio to the clients' simulation based on input sent from other players/the server. Certain key events that trigger particles, sound, or state changes (like item hits) could be sent through RPCs if possible.

    This sounds like it could take a lot of refactoring work and unfortunately I don't currently have plans for an update of this magnitude. However I can still give some pointers where I can as you develop your game.
     
  47. AaronKB

    AaronKB

    Joined:
    Aug 16, 2019
    Posts:
    27
    Thanks for the reply. I have managed to get basic Kart mirroring across the network (With wheel turns, and spins) so that's a start. I think for things like tiremarks, exhasust etc I may need to have a proxy on the spawned prefabs that will issue spawns to clients so they can replicate it.

    I'll see how I go and if I have any major problems I'll post here.

    Cheers
     
  48. lukasynthetic

    lukasynthetic

    Joined:
    May 20, 2020
    Posts:
    23
    Good morning. First of all thank you for making this asset. It's good and the results are satisfying - well done.
    I've been following the manual how to set up my own cars - managed! There was only one bit of uncertainty (but accomodated for in the manual anyway) - to have the wheels spin correctly I had to create a child object of Visual Mesh and rotate it in opposite direction (Visual Mesh is rotated Y:90 while the wheel mesh is Y:-90). It works.

    Now to the issue:
    First screenshot shows the car whith all wheels on the surface of the road (the asset used is Toon Racing by SICS Games).
    The second shows how front wheels drop slighlty down when moving into another segment. And the last one when all wheels are 'under' the surface.
    It happens only few times on this track. Always in same spots. Sometimes the wheels start jittering up and down like on a rough surface - which this one isn't. Sometimes the camera goes under the car for a few seconds.

    Now I did a bit of digging. First to eliminate the road surface as a culprit.
    I changed mesh colliders to box - didn't help. Also the bends cannot really use box colliders.
    I checked the meshes in Blender - nothing out of ordinary.
    After that I used different car assets with the same track:
    - Universal Vehicle Controller: not an issue
    - NWH Vehicle Physics: also no issue.
    I own few more (Edy's etc.) but I don't think is the meshes - in few places it's just repeated segment and the car behaves differently on one copy than the other placed next to each other!

    Then I played with wheel settings without success - Max wheel cast set to stupid high 200
    Checked One wheel Per Frame
    Ground normal smooth rate - went from 1 to 1000. Also no change here.

    Last three screenshots show the car setup (I disabled the colliders, particles and audio for visibility).
    The suspension is set to max height when compressed (as explained in manual) and the raycasts extend below the wheels.
     

    Attached Files:

  49. lukasynthetic

    lukasynthetic

    Joined:
    May 20, 2020
    Posts:
    23
  50. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    374
    That is a very strange issue. I can't thing of anything obvious that could changed other than the corner cast variables since the corner cast gizmos are underneath your car when they should start inside the vehicle. However this shouldn't cause anything like the problem you're having. Would it be possible for you to share the project so I can take a look?

    Edit: Something else I want to ask is if this happens with the included prefabs?
     
    Last edited: Jun 8, 2022