Search Unity

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:
    376
    Just remember how I said I'm in the process of moving in post #130, so I don't know exactly when the feature will be added. I'm also going to be unavailable for providing support from Thursday through the weekend.
     
  2. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Yes, but i think this is nice feature. I hope you will add it soon. :) Thanks
     
  3. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    Okay probably my last question (sorry for a lot of them)
    But in the VehicleMenu script, is there a way to get rid of the excess components (camera, chasevehicle, etc.) and keep the core ones like speedo, gears, RPM, boost?
    Without the object reference not being set to an instance of an object?

    Cheers
    Sorry for the questions I bet your sick of them(;

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4.  
    5. //Class for the menu and HUD in the demo
    6. public class VehicleMenu : MonoBehaviour
    7. {
    8.     public CameraControl cam;
    9.     public Vector3 spawnPoint;
    10.     public Vector3 spawnRot;
    11.     public GameObject[] vehicles;
    12.     public GameObject chaseVehicle;
    13.     public GameObject chaseVehicleDamage;
    14.     float chaseCarSpawnTime;
    15.     GameObject newVehicle;
    16.     bool autoShift;
    17.     bool assist;
    18.     bool stuntMode;
    19.     public Toggle autoShiftToggle;
    20.     public Toggle assistToggle;
    21.     public Toggle stuntToggle;
    22.     public Text speedText;
    23.     public Text gearText;
    24.     public Slider rpmMeter;
    25.     public Slider boostMeter;
    26.     public Text propertySetterText;
    27.     public Text stuntText;
    28.     public Text scoreText;
    29.     public Toggle camToggle;
    30.     VehicleParent vp;
    31.     Motor engine;
    32.     Transmission trans;
    33.     GearboxTransmission gearbox;
    34.     ContinuousTransmission varTrans;
    35.     StuntDetect stunter;
    36.     float stuntEndTime = -1;
    37.     PropertyToggleSetter propertySetter;
     
  4. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    You can just remove the unnecessary variables, just make sure to use the find tool to find all references to the unwanted variables and remove those too.
     
  5. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Hi guys!

    I had recently worked on the integration of Randomation and iRDS and they are now officially compatible.

    Thanks @RandomationGames !

    Rhod,
     
    HakJak likes this.
  6. rolliefingez

    rolliefingez

    Joined:
    Apr 4, 2013
    Posts:
    23
    Hi there, Im assuming that @RandomationGames is still trying to move state. I have emailed regarding this also but just wanted to check if anyone could help me. I am trying to setup a new scene with just a plane and a car, I have copied controlling prefabs out of one of the demo scenes along with a car. Now when I run the scene the car sinks into the plane and wont drive. I see someone earlier in the thread had the same issue and I have tried to set the wheel cast mask etc but doesnt seem to have an effect. Anyone give any pointers creating a new blank scene setup?

    sink.png
     
  7. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    I just created a new scene, added in the GlobalControl and TimeMaster prefabs, then a car prefab and it seemed to work fine. Maybe it has something to do with the project settings? Also make sure the vehicle is the JS version, since I see you're using the JS GlobalControl object.

    I'm also not going to be moving after all, so I can resume development and the usual support.
     
  8. rolliefingez

    rolliefingez

    Joined:
    Apr 4, 2013
    Posts:
    23
    thanks Randomation for excellent support via email. Indeed I am up and running!
     
    HakJak likes this.
  9. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    I'm finding my vehicles are not sliding sideways enough. So when I apply acceleration, it seems the vehicle grips forward unnaturally and actually picks up speed as it goes around the corner, instead of the acceleration in the slide compensating for the sliding.

    I've played around with sideways and forwards friction, brought forwards friction right down, but it still feels unnatural.
    Any tips on how to get a better drifting/sliding effect that feels more natural?
     
  10. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    What ground mesh are you using? Terrain, mesh (objects) or even a roading system like RoadArchitect - because I noticed this with RoadArchitect - it felt way too off with the friction
     
    Meltdown likes this.
  11. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    I'm using a custom race track mesh. It's mostly flat. I've now spent hours playing with friction curves, sideways friction etc etc, but nothing feels right :(

    Like if I'm coming to a sharp corner on my sand surface, and am heading in the right direction, and accelerate, it just magically goes forward instead of sliding sideways with the momentum I took into the corner.
     
  12. woodsynzl

    woodsynzl

    Joined:
    Apr 8, 2015
    Posts:
    156
    Well you could assign the surface type instance srcipt to the mesh? And change the interger to the one on the GlobalControl gameobject
     
  13. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Yeah, that's kind of a requirement of the package, nothing new.
     
  14. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Have you tried changing the slip dependence variable?

    From the manual:

    Dependent
    might be the one you're looking for.
     
  15. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Yes, I've been through the manual thoroughly and changed everything relating to tire friction. To be honest those options don't seem to make much difference to me. Dependant sounded like what I needed in the manual, but it makes no difference.
     
  16. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Is the VehicleAssist script attached to the vehicle? If so, I think the drift push variable is what's causing the problem.
     
  17. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Yes it is, so what should I do?
     
  18. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Try setting the drift push variable to zero, since it assists the vehicle by pushing it forward during drifts.
     
  19. HakJak

    HakJak

    Joined:
    Dec 2, 2014
    Posts:
    192
    What is the mass of your vehicle body? Do you have any other parts/game objects attached? If so, what are those masses? The mass and drags of your vehicle can have a big impact on how it handles and slides.

    Center of gravity and suspension settings can be important too, depending on what you're making.

    Not sure if that helps, but something I found useful to tweak when setting up mine.
     
  20. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    This seems to be along the lines of what I'm going for, but then when the truck drifts, there seems to be no drive coming from the wheels, they stay completely still without spinning, instead of spinning and trying to dig in to get grip to move forward. What could I tweak to fix this?
     
  21. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    After spending some time isolating different parts of the code and experimenting, I've realized that the way RPMs are applied to the wheels is part of the problem. I believe I also have a solution to the issue with transmissions slipping and shifting prematurely, but that's not related to your problem.

    If you are using an automatic transmission, the downshifting that occurs when you drift/lose speed could be factoring into the wheels not spinning, since the wheels lose their drive during shifts.

    I'm going to work on a solution to the wheel RPM problem in the next update, but I don't have it ready to post here. For now you could try increasing the forward friction of the wheels, or increasing the drift push variable to something like 0.5.
     
    Meltdown likes this.
  22. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Thanks, but I've tried that (spent many hours since yesterday). I look forward to the updated solution. Can you post in this thread when it's released.
     
  23. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Yes, I think part of this solution is going to involve adding yet another animation curve for finer control.
     
  24. WaqarKhan703

    WaqarKhan703

    Joined:
    Sep 9, 2013
    Posts:
    7
    Hi RandomationGames,

    This is one of the best vehicle packages I came across. Helped me alot. I just wanna ask is there any option for "Auto Throttle" in the package. Specifically I need this for mobiles.
     
  25. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    No, but it should be easy to implement. You can look at the BasicInput script for an example of how to set input, the SetAccel function in the VehicleParent script controls the throttle, using a float ranging from 0 to 1.
     
  26. Neoshiftr

    Neoshiftr

    Joined:
    Dec 5, 2012
    Posts:
    67
    Hello,

    I just purchased this asset and tried to import it into an empty project, but I get this error:

    Assets/Randomation Vehicle Physics 2.0/Scripts/C#/DetachablePart.cs(95,48): error CS1061: Type `UnityEngine.JointLimits' does not contain a definition for `bounciness' and no extension method `bounciness' of type `UnityEngine.JointLimits' could be found (are you missing a using directive or an assembly reference?)

    I am using the latest Unity version. Any solution for this?

    Sincerely,
    Kia.
     
  27. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Are you certain you're using Unity 5.1? The release notes page mentions minBounce and maxBounce being replaced by bounciness. The documentation also indicates that bounciness is defined in JointLimits.
     
  28. Neoshiftr

    Neoshiftr

    Joined:
    Dec 5, 2012
    Posts:
    67
    Hello,
    It's working now, thanks.
    But I've got another problem, the prefab is floating in the air, it drives like it was on ground (when I pull it up in the editor it falls down to the same height, in air), but the controls are "too easy", like you steer the car too smooth (because of being in air?).

    upload_2015-7-30_13-31-27.png
     
    Last edited: Jul 30, 2015
  29. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    I'm not sure what could be causing this other than some invisible collider since the wheels appear to be fully extended. Can you post a video so I can see how the car is moving?

    -------------------

    I've also submitted a new update, the changelog will be revealed once it's released.
     
  30. Neoshiftr

    Neoshiftr

    Joined:
    Dec 5, 2012
    Posts:
    67
     
  31. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    When you select the car and show the wheel gizmos, I see that the physical wheels are set to be much larger than the visual ones, try reducing them down to their normal size. The center of gravity of the car looks like it's too low as well, since it tilts the opposite way it should during turns. Take a look at the "center of mass offset" variable on the VehicleParent script attached to the root transform of the vehicle and make sure the y-value isn't too low.
     
  32. Neoshiftr

    Neoshiftr

    Joined:
    Dec 5, 2012
    Posts:
    67
    Thanks, everything working fine now. :)
     
  33. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Version 2.05 has been released with the following changes:

    Wheel
    – New “feedback RPM bias” variable for finer control over the feedback RPM. Increasing this can allow vehicles to peel out without automatic transmissions upshifting to compensate for the spinning.

    New “RPM bias curve” variable for finer control over output RPM.

    Null check for tire before trying to deactivate it upon popping.

    Opposing friction forces are now applied to rigidbodies the vehicle sits on.

    Suspension – Opposing suspension forces are now applied to rigidbodies the vehicle sits on.

    VehicleAssist – New “fall speed limit” and “apply fall limit upwards” variables for limiting fall speed.

    FlipControl – New “ground check distance” and “ground steepness limit” variables for rotation correction based on ground normal.

    Refer to the documentation for more details on the variables.
     
    Meltdown likes this.
  34. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Hi, any chance for automatic rotation when car fly after move on the ramp in the next update ? Thanks.
     
  35. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Wow thanks for these updates, this is an excellent example of a well supported asset store product owner who listens to what his customers need.
     
    HakJak likes this.
  36. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Can you explain exactly what kind of rotation you want? Like automatic flipping for stunts?

    That is the goal, I'm glad you and others appreciate the asset.

    Have the changes fixed your problem with sliding?
     
  37. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    I think he's talking about something like this:



    CoderPro brought this up before in March, on the first page.
     
  38. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    The RPM bias curve is extremely sensitive. If I just move it the slightest fraction off the linear curve, I saw some very minor improvement.

    But any more adjustment to the curve, and the vehicle would just wheelspin the whole time from when standing still. So yeah, it's still not quite where I want it to be. It seems right now it's an 'all or nothing' scenario when it comes to the wheels spinning or not, with no middle ground.

    Could you provide one or two sample curves that you think would work well?
     
  39. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Its like in Asphalt 8 game, like this. I thinks they make car automatic rotation when move over through the ramp.




    Yes, maybe also like this.
     
  40. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Just moving the left key of the curve upwards slightly should help a bit, since the zero-value on the x-axis represents the lowest torque output, and moving the key up a bit means that the wheels will have at least some output RPM despite minimal torque.

    I'm noticing now that this causes the wheels to spin more in the higher gears since their output RPM is higher. I'll look into a fix for this, maybe having a second curve for the higher RPMs to interpolate with so that you can have more control between low and high RPMs. Part of the reason it's so sensitive is because torque in RVP is mostly kept between 0 and 1 for the sake of easier interpolating when calculating the final RPM of the wheels. Maybe factoring in the friction and slip could help as well.

    It's difficult to tell exactly what you want based on still images, but I looked up some videos of Asphalt 8 stunts.

    It seems as if the shape of the ramp influences barrel rolls, while the player's control forces them to spin laterally. Have you tried making a corkscrew ramp and disabling rotation corrections on the FlipControl script?
     
    Meltdown likes this.
  41. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    I mean if we can make a system that car could automatic rotation based on corkscrew ramp using scripts that not using normal rigidbody of Unity. (Airborne Controller)

    Car -- Move On --> Corkscrew Ramp --> (Automatic) Rotation (By scripts not by Rigidbody) !
     
  42. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    I feel like this may be too specialized of a feature to be included in the package, I don't want to clutter it with features that very few customers may need. If more users want this I might include it.
     
    CoderPro and Meltdown like this.
  43. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    I think everyone want to this features will be add to the next update. Its very very cool and good features. Please add this to the next update. Many thanks !!!
     
  44. HakJak

    HakJak

    Joined:
    Dec 2, 2014
    Posts:
    192
    I disagree... this package is for vehicle physics and should focus on excelling in that area. Specialized scripts like you described are something you should develop yourself or find a partner to help you with.
     
    Meltdown likes this.
  45. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    So that features not belong to vehicle physics ? Do you understand about vehicle physics that you are saying ?
    You don't see @RandomationGames said that "I feel like this may be too specialized of a feature to be included in the package" ? I think you don't understand what is vehicle physics !

    And you must to understand. That is my request only. If @RandomationGames don't like, and don't want to add this, i can not do anything. That is my opinion !
     
    Last edited: Aug 3, 2015
  46. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    Technically it is vehicle physics, but it's too specialized to be included in a general purpose vehicle physics asset such as this. Assets are meant to serve as a starting point, and there will always be particular features that only your game needs which you will have to learn to implement.
     
    Meltdown likes this.
  47. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    I tried and that and it does seem to help in the turns, thanks.

    Although another case where it seems very unnatural is if the vehicle is in reverse. So going quite fast backwards, and then you accelerate. Once again the wheels hardly seem to move or spin. You would think if the vehicle was accelerating while moving backwards the wheels would start spinning and trying to gain traction.
     
  48. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    I am seeing the same problem, it's because of the way torque is sent through the drivetrain and the way the engine's RPMs are determined, but I think I have a fix. I still have to do more testing with it.
     
    Meltdown likes this.
  49. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Thanks, one other issue I'm battling with is getting the suspension right.
    I've literally played around with every setting for hours, but cannot find a happy medium between the two :(

    I have either one of the following scenarios...

    - My truck suspension is very forgiving, and goes over bumps easily, and the suspension soaks the bumps up. But the problem is that when the suspension is like this, my truck doesn't 'jump' at all when flying off a ramp or going over a bump at high speed. It seems to just go straight down and almost 'sticks' to the track.

    - In the other scenario, the opposite is true. My truck jumps off bumps quite easily and gets some nice air. But the problem is when it comes to small bumps it bounces erratically and gets thrown off and onto its side easily. Sometimes even just when driving on a straight it ends up on its side.

    Any tips?
     
  50. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    376
    What happens in the second scenario when you increase the dampening?