Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Randomation Vehicle Physics 2.0 - Now open source on GitHub!

Discussion in 'Assets and Asset Store' started by JustInvoke, Mar 14, 2015.

  1. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    It's the VehicleDebug script on the root transform.
     
  2. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    Oh thank you! Couldn't find anything referencing it to it.

    Also you can check out the thread for my new multiplayer game using RVP 2 here
     
  3. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    Okay, well I disabled the components, so the R and Z keys don't work (which is what I want) but the X key still resets the session, even with the VehicleDebug removed

    EDIT: Found it just after, was looking around the wrong areas, because the hotkey to quit the session is X, duh
     
    Last edited: Nov 12, 2015
  4. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    Version 2.08 has been released with the following changes:
    • New “Car Damage” and “Hover Car Damage” prefabs to serve as simpler examples of damageable vehicles.
    • Tires on the mobile muscle car prefab have been given a simpler material that doesn't deform, since the original material doesn't show up on certain platforms.
    • Motor – Audio's target pitch is set to zero when ignition is false.
    • GasMotor – Output torque/RPM and feedback RPM are set to zero when ignition is false. Moved setting of targetDrive.curve to outside of ignition branch.
    • Wheel – Vehicle's name is part of detached wheel's name. New “forward slip dependence” and “sideways slip dependence” variables for finer tuning of friction behavior. The effect of these variables is most noticeable when the slip dependence is set to Independent. Tweaking them can help to reduce jitter with lower fixed timesteps.
    • HoverWheel – Vehicle's name is part of detached wheel's name.
    • VehicleDamage – Refactoring of damage system and new ApplyDamage() function. This function is useful for damaging vehicles without relying on collisions, such as with explosions. The constructors are documented in the VehicleDamage section of the manual.
    • Suspension – “Detached compression” variable is limited between 0 and 1.
    I'll be busy throughout the holidays, so this will be the last update for the year unless a serious bug is discovered.
     
    Der_Kevin and woodsynzl like this.
  5. iamspugeddy

    iamspugeddy

    Joined:
    Oct 8, 2015
    Posts:
    6
    I'm trying to implement an on/off ignition system for the cars. It works, except if you're holding down the accelerator when you turn the ignition off the vehicle still has acceleration controls. This doesn't happen if you disable ignition when the accelerator isn't being pressed. Any ideas?
     
  6. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    Are you using the latest version? I just tested this by setting the ignition to false through script while accelerating, and it did not accelerate further. The brakes still work as they should.
     
  7. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    357
    Seems Unity 5.3 broke it...
    New project, Imported from asset store...opened C# demo, play and:

     
  8. maruska

    maruska

    Joined:
    Jun 1, 2013
    Posts:
    9
    I just installed the Unity 5.3 update and now my cars all act like they are in a tornado. They just get blown around uncontrollably.

    I even created a fresh project and imported a fresh instance of Vehicle Physics 2.08 and tried the test track. All cars seem to affected.They just twirl around on their noses...

    Anyone else having this issue? Thoughts?
     
  9. maruska

    maruska

    Joined:
    Jun 1, 2013
    Posts:
    9
    Yup - that's the problem!
     
  10. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    314
    Just should waiting for author update it on Unity 5.3.
     
  11. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    This is because of changes to the physics, where the inertia tensor isn't tied to the center of mass anymore. I'm still trying to understand how it works since I haven't worked with the inertia tensor before.

    After some tests, it seems that setting the inertia tensor to equal itself fixes the problem. Try adding this after line 367 in the VehicleParent script, where the center of mass is set. The line count obviously varies if you've modified it, and it's in the SetCenterOfMass() method.
    Code (csharp):
    1. rb.inertiaTensor = rb.inertiaTensor;
    This strange solution makes me wary of what else might be broken, since it doesn't seem like intended behavior for the act of simply setting the variable to cause it behave so differently. I'm going to file a bug report and see what Unity has to say, I don't want to rush out a hotfix just yet.

    Edit: It also appears there is severe lag when spawning multiple instances of the muscle car and colliding them into each other. It even happens when I disable the collisions between them and they pass through each other, so I know it's not related to the damage script. The profiler indicates that it's related to the wheel script for some reason.

    None of this was a problem in 5.2, I really don't know what to do about this.
     
    Last edited: Dec 10, 2015
  12. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    I've submitted an update fixing all of the warnings in Unity 5.3 as well as the issue in the video posted earlier.

    After submitting a bug report regarding the inertia tensor, the gist of the response I received is that it's not a bug, but a feature, even though setting the inertia tensor to equal itself throws a warning from the JS version since setting a variable to equal itself is so kludgy that even the compiler wonders if it's a mistake. Whatever it takes to make it work, I suppose. (In the JS version I declared a temporary variable to avoid the warning.)

    I still don't know why it lags so much when damageable vehicles collide, and it turns out that the damage script is the source of the problem, even though it was fine in Unity 5.2. I still made a minor optimization to the damage script and the wheel script, but it's not helping much.
     
    Last edited: Dec 11, 2015
  13. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    Version 2.08.1 has been released with the following changes:

    NOTE: The “legacy torque multiplier” variable of the Transmission script is obsolete and will be removed in a future update. The PowNatural() function of the F script will also be removed.

    Inverted spring target position on trunk of muscle car due to changes to hinge joints in Unity 5.3.

    VehicleParent – Set inertia tensor of rigidbody to be equal to itself due to decoupling of center of mass and inertia tensor in Unity 5.3.

    VehicleMenu – Fixed implicit downcast warnings.

    Wheel – Feedback RPM is set to zero when wheel is jammed or detached. Removed redundant IsChildOf() check from GetWheelContact(). Fixed bug where detached wheel’s tire material was not set correctly if “deform amount” is set to zero.

    VehicleDamage – Slight refactoring to avoid redundant mesh vertex assignments.

    GlobalControl – Level restarting uses new SceneManager class in Unity 5.3.

    PerformanceStats – Level restarting uses new SceneManager class in Unity 5.3.

    Motor – Refactored setting of particle emission rates for Unity 5.3.

    TireMarkCreate – Refactored setting of particle emission rates for Unity 5.3.

    Now this should be the last update of the year since I'm going to be very busy until part way into January.
     
    woodsynzl likes this.
  14. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    @RandomationGames , may I ask if you're working on any games with these physics yourself?
     
  15. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    No, but I am working a vertical slice of a kart racer with suspension calculations copied from RVP.
     
    HakJak likes this.
  16. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    Anyone gotten any closer in syncing crashes over the network?

    Also, @RandomationGames someone with a very substantial amount of subscribers did a gameplay of my game using RVP 2.0. At the moment it's still basic but I'm adding in a lot of things... I hope you don't mind me using some stock vehicles
     
    Last edited: Dec 16, 2015
  17. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    It's great to see a game with my physics getting that kind of exposure.

    As for syncing the damage over the network, have you tried the new ApplyDamage() function in the VehicleDamage script? You might be able to send collision info over the network, then use it to call the ApplyDamage() function on each user's device. You would have to comment out the part where damage is applied in OnCollisionEnter.

    Also, I've got more info regarding the inertia tensor, and there is in fact a bug in the way it's set, but for now setting it to equal itself works fine.
     
  18. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    357
    Here is that prototype I showed before, I put it up on facebook and some how it's getting alot of players??
    Currently getting over 3500 players per day and growing? so strange cause I really didn't post the link any where.

    https://www.facebook.com/games/soccargame/?fbs=-1&preview=1&locale=en_US
     
    JustInvoke likes this.
  19. Rusfighter

    Rusfighter

    Joined:
    Jan 18, 2014
    Posts:
    60
    Hello RandomationGames,
    i am considering to buy your package, but i dont know if it is possible to achieve my needs.

    I want to create a game familar to https://play.google.com/store/apps/details?id=com.rkgames.smashywanted , which is also for mobile. If you play the game, the car physics are very arcadish but still realistic. Especially when you drive half on the way and half on the grass.

    I dont need any spring effects or other fancy stuff (as you see in smashy road wanted). But it requires to have up to 60 wheels on the screen.

    I wonder if smashy road physics can be achieved with your package or if that your package is too overkill (or not suited) for this purpose?

    Thanks,

    Ilija
     
  20. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    I think my physics are overkill for this, and 60 vehicles is too much for mobile with my system unfortunately. You could do something much simpler with something like 1 raycast for each vehicle and applying some basic driving forces directly to the rigidbodies along with a low friction physic material, so they can just slide along the ground. Add some opposing force opposite of the local sideways velocity to keep vehicles driving straight, and some driving/braking force in the local forward direction.
     
  21. Rusfighter

    Rusfighter

    Joined:
    Jan 18, 2014
    Posts:
    60
    Thanks for the answer. I meant 60 wheels = 15 vehicles. I know for a fact that they used edy's vehicle system for player and police but i can't reproduce it with his package.

    The problem with simple rigidbody is that if you have soms height difference, like a sidewalk near the road, the rigidbody flies up if you ride over it. In real situation, this won't happen because of the wheels springs and damping.

    Any idea how to solve this?

    Thanks
     
  22. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    357
    Tested 5.3.1...broke (atleast for Musle Car)
    Constant Errors if you select The musle car, which kills FPS.
    *other cars seem fine

    Edit:
    (5.3.1)Seems the issue is related to the Particles on the car
    http://forum.unity3d.com/threads/5-3-released.372567/page-5#post-2429593
    Unity bug? maybe they need to recall 5.3.1 - seems like a big issue
    But the import problem I think is a "critical" issue


    Also won't import into 5.2.3

     
    Last edited: Dec 18, 2015
  23. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    I'm currently wrapped up in moving state and Christmas plans, but I might get a chance to look at this one day next week with 5.3.1. I won't be able to work on any updates until sometime in January.

    I had to make changes for Unity 5.3.0 to remove warnings, which unfortunately broke compatibility with 5.2 because of the new SceneManager class. In order to use RVP 2.08.1 you will have to either upgrade to Unity 5.3 or change the scene loading code to use Application.LoadLevel like before.
     
  24. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    You could try spawning more chase cars in the Android demo for RVP and see how they perform on you target device. There is a link in the first post.
     
  25. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    357
    Why would you break compatibility for EVERY version but 5.3?
    You do know we can't download previous versions?

    Telling people to upgrade to an Unstable version is not a good solution when all you had to do was:
    http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
    Code (CSharp):
    1. #if UNITY_5_3
    2. using UnityEngine.SceneManagement;
    3. #endif
    4.  
    5. ----------------------------------------------------------------------------------------
    6.  
    7.     void Update()
    8.     {
    9.         if (quickRestart)
    10.         {
    11.             if (Input.GetButtonDown("Restart"))
    12.             {
    13. #if UNITY_5_3
    14.                 SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    15. #else
    16.                 Application.LoadLevel(Application.loadedLevel);
    17. #endif
    18.                 Time.timeScale = 1;
    19.                 Time.fixedDeltaTime = initialFixedTime;
    20.             }
    21.         }
    22.     }
    23.  
    24. ----------------------------------------------------------------------------------------
    25.     public void Restart()
    26.     {
    27. #if UNITY_5_3
    28.         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    29. #else
    30.         Application.LoadLevel(Application.loadedLevel);
    31. #endif
    32.         Time.timeScale = 1;
    33.     }
    34.  
    35.  
    36. etc....
    37.  
     
  26. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    Sorry, I forgot about platform depend compilation, I will look into adding it in the future.

    You can download previous versions of Unity here:
    https://unity3d.com/get-unity/download/archive
     
  27. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    357
    lol, I was talking about previous versions of Randomation Vehicle Physics not unity.
    The asset store doesn't have a way to pick a previous version of an asset, you can only download the last version you submitted.
    Did you not know that?

    I can fix it, but anyone that buys RVP and not on 5.3 is going to be pissed.

    Edit:
    Fixed the code so it's platform independant.
    Sent the project to RandomationGames for testing.
     
    Last edited: Dec 19, 2015
  28. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    I know you can only download the latest version, but there is only so much I can do. I will take a look at platform dependent compilation when I have time, but I'm hesitant to clutter the code with duplicate but slightly different versions of methods/expressions for the sake of supporting multiple versions of Unity.
     
  29. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    There is a way to make your versions of the product in the Asset Store require specific versions of Unity or older versions are downloaded. I know the ShaderForge guy does this. That's probably the way you want to go.

    Also, Unity 5.3 is officially released so technically it's not "unstable" anymore. I haven't used it yet so I can't say whether it's unstable in use though.
     
  30. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    I uploaded the latest version with 5.3, so the store page already says that it requires 5.3 or later to work. I still have to think about how I should go about this, even though I've done this before with new versions of Unity in the past and had no backlash. Supporting multiple versions might be too much for me right now.
     
  31. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    314
    I'm agree with you.
     
  32. hamyshank

    hamyshank

    Joined:
    Jan 31, 2013
    Posts:
    88
    ^same, I would prefer for the asset to be compatible with the latest Unity version. If you can't upgrade your Unity version then don't update your version of the asset. Just my opinion.
     
  33. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    @RandomationGames did you design all the 3d models yourself? Or did you contract someone? Because I really like the design type of them since they are actually perfect for my game!
     
  34. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    I made them, thanks. I figured a simple style was good for demonstrating the package instead of weighing it down with high poly models and large textures.
     
    HakJak likes this.
  35. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    They are really good for performance and they work extremely well with the VehicleDamage script. I hope you don't mind me using some in my game, as I'm still working on building my own. Cheers.
     
  36. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    240
    Hey guys,

    I just bought this asset and like others, noticed the error flood with the muscle car.

    So after some research into the issue, I installed Unity 3D patch 5.3.1p1 and can confirm it fixed the "Invalid AABB result" particle effect errors. I'm back in business now! Really liking this asset so far! :)

    Download the 5.3.1p1 patch here:
    http://unity3d.com/unity/qa/patch-releases
     
    HakJak likes this.
  37. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    340
    Pretty much this, I just wanted to confirm that it is in fact a Unity problem and I cannot fix it. There is also discussion about it here.

    I have been moving home during the past few days, but now my PC is set up again so I can resume work and reply to e-mails.
     
  38. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    Okay, now this will probably be a really simple answer but I can't seem to find it.

    What I'm looking for is where the value of the boost is stored, as I can't find it under the GasMotor script, or VP.

    Thanks

    Edit: Found it, I was looking under the wrong class. It was in the Motor script rather than GasMotor
     
  39. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    507
    Hey! i have a question regarding the waypoint system. iam currently working on a leveleditor:


    and i also want that users have to define the waypoints or even put a waypoint inside the track prefab (the road that you can around and connects automatically.)
    i think the RVP waypoint system already works pretty good but is there a way to somehow let the waypoints connect automatically? so that i don't have to manually put in the next point?
     
  40. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    @Der_Kevin I really, really like that level editor, and I'm willing to purchase one... Will that be on the asset store anytime soon?
     
  41. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,491
    I'm really battling to get the nitrous boost working 'effectively'. Ultimately I'd like my vehicle to go about 3 times it's speed when boosted, but no matter what values I try, the boost is always a very small amount.

    My engine power is set to 1, I'm trying to set it to 3, but the engine just makes a 'turning over' sound and the vehicle goes even slower.

    I've tried copying the sample data and boost power curve from the prefab vehicles, but it makes no difference.

    Is there some formula for working out some good boost values?

    Here is my engine in the inspector...

     
  42. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,491
    @RandomationGames
    Any response to my question on Nitro? I really need to be able to increase my vehicles speed quite visibly when Nitro is used.
     
  43. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    357
    I'm sure this is not the "proper" way...but has the effect I was looking for.

    I increase the power and friction on the wheels when the boost is held down, and restore the normal values otherwise

    in my update loop

    Code (CSharp):
    1.        
    2.  if (vp.groundedWheels == 4 && vp.boostButton)
    3.         {
    4.             float f = 15;
    5.            
    6.             vp.engine.power = 1.25f;
    7.             _LFW.forwardFriction = f;
    8.             _LRW.forwardFriction = f;  
    9.             _RFW.forwardFriction = f;
    10.             _RRW.forwardFriction = f;
    11.            
    12.             _LFW.sidewaysFriction = f;
    13.             _LRW.sidewaysFriction = f;  
    14.             _RFW.sidewaysFriction = f;
    15.             _RRW.sidewaysFriction = f;
    16.         }
    17.         else
    18.         {
    19.             vp.engine.power = 1;
    20.    
    21.             _LFW.forwardFriction = _Front_FFriction;
    22.             _RFW.forwardFriction = _Front_FFriction;
    23.            
    24.             _LRW.forwardFriction = _Rear_FFriction;  
    25.             _RRW.forwardFriction = _Rear_FFriction;  
    26.            
    27.             _LFW.sidewaysFriction = _Front_SFriction;
    28.             _RFW.sidewaysFriction = _Front_SFriction;
    29.            
    30.             _LRW.sidewaysFriction = _Rear_SFriction;  
    31.             _RRW.sidewaysFriction = _Rear_SFriction;  
    32.         }
     
    Meltdown likes this.
  44. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,491
    Thanks @bocs I'll give that a try.

    EDIT : It works really well, thanks for the idea :)
     
    Last edited: Jan 26, 2016
  45. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,050
    I'm using RVP 2.08.1 and Unity 5.3.1 f1 and sometimes the main camera spams this error in the console:

     
  46. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,050
    Any reply to this?
     
  47. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    I have used this package for a long time but 5.3.2 has broke it i think, If i import into a new project and start the demo scene the cars are just crazy!

    For instance when the car lands the right side will bounce up, some of the AI vehicles are just spinning out of control? Anyone else have this problem?
     
  48. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,491
    Did you install the latest version of the package, I know it fixed some issues in 5.3
     
  49. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    94
    Hi,

    Any ideas why the cars end up like this when I place them in a scene, the ground in the pic has a collider.
     

    Attached Files:

  50. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    Have you got the TimeMaster and GlobalControl prefabs in your scene?
     
unityunity