Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Assets MS Vehicle System (Vehicle controller)

Discussion in 'Works In Progress' started by Marcos-Schultz, Aug 8, 2018.

  1. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Marco this looks great, keep up the great work ;)
     
  2. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Could you provide me with the 3D model of the vehicle you have?

    I'd like to devise the suspension system in a way that works well on your model, and at the same time, is generic enough for other 3D models.
     
  3. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Unfortunately I cant as the model isn't mine, apologies
     
  4. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    No problems. Anyway, I will try to create a rather generic system, to adapt to most cases.
     
    iichiversii likes this.
  5. Delforce

    Delforce

    Joined:
    Jun 3, 2015
    Posts:
    9
    Hi Marcos,
    I like the way this asset works from the video samples.

    Today I thought I'll have a look at it however when I open the Scene you provided called ExtremelyStable and press play my car falls through the terrain endlessly. I can't see why this would happen given I just imported the asset and used an out of the box scene.

    Any ideas? Looks like the coliders are there and it's set to use all for terrain location setting.

    Cheers
    Del.
     
    Marcos-Schultz likes this.
  6. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello, thank you for contacting us.

    This really is weird, it should not happen. I'll try to find out what happened. Could you answer some questions so that I can try to identify the problem?

    1 - Which version of Unity are you using?
    2 - What version of asset 'MSVehicleSystem' are you using?
    3 - Are you using any other resources together? Or is it an empty project with only my imported feature?
    4 - Is there an error message on the console? Or any warning messages?
    5 - Do other demonstration scenes also have this problem?

    I want to try to help as much as possible, to try to discover possible errors and correct them as soon as possible.
     
  7. Delforce

    Delforce

    Joined:
    Jun 3, 2015
    Posts:
    9
    Hi Marcos,
    Thanks for the reply I appreciate your help.

    1- I'm using Unity Version 2018.3.0f2 Personal

    2- I'm using version 3.2.5 MS Vehicle System

    3- I'm using tones of other resources in the project, more than likely something is conflicting with something.. I keep all my resources I want to use in one project so I can test their integration and fix any issues I find in the C# code when there are conflicts.
    I used your Import feature from the unity asset store after the download from my assets within unity.

    4-No messages for compiling or in the console at all, that's what confused me so much, I was expecting some code issue or a setting I was missing, or namespace conflicts like I usually get with assets I want to integrate. I was hoping it was that my terrain needed some sort of tag etc.. but this was your demo scene so I assume the settings there are correct unless it requires some other external project setting I'm missing.

    5- I tested all of your demonstration scenes and the car falls in all of them.

    Just to add, none of my other scenes do this which is also really weird. There must be some physics setting that has been inadvertently changed.

    I'll have a go at importing the MS Vehicle System demo's into a single project to see if I can isolate the issue given that it's not obvious to you what the cause could be.

    Yeah so I just tried a new project with just your asset and bingo everything works. Looks like I'll have to go with elimination process to find where the issue is unfortunately. If I get to the bottom of the conflicting asset I'll let you know.

    Cheers
    Del
     
    Last edited: Apr 26, 2019
    Marcos-Schultz likes this.
  8. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Anymore updates on the suspension system or any other future updates, I am really looking forward to whats next
     
  9. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Is "wheel Controller" 3D compatible with this plugin?
     
  10. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello. Update 3.3.0 is ready and will be available in a few days.

    ...............[Version 3.3.0]...............
    - The vehicles (prefabs) have been adjusted and improved.
    - A warning has been added to avoid problems or errors when using the 'steeringAssist' feature.
    - It is now possible to use a 'custom material' for the skidmarks of the vehicle.
    - Some particles were redone.
    - It is now possible to set how long it will take for the vehicle to start the engine.
    - Fixed an error that was issuing an alert on the virtual joystick code.
    - The wheel settings class has been reorganized and improved.
    - A simple system to simulate vehicle suspension springs has been implemented.

    Note: This suspension system is new and will be greatly improved according to user feedback.
     
    iichiversii likes this.
  11. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    I've already tried to implement compatibility with this feature, but NWH works with variable names that are very different from the default wheelCollider, and when there are updates to its code, sometimes it changes a few things.

    The 'wheelCollider' component is stable, there are no changes to its code and it is integrated directly into PhysX, which allows you to use 'substeps' for the simulation of physics.

    For compatibility with the 'wheelController3D' component it would have to be stable and a bit more like the PhysX standard 'wheelCollider'.
     
    iichiversii likes this.
  12. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Hey Marcos, I just noticed the steering wheel rotates on the worlds axis rather than the steering wheels own axis, my steering wheel is set at an angle and as Im using it in an APC the steering wheel can has to be raised and lowered to 2 separate positions depending on if the driver drives from the inside or the upper position, it would make more sense if the steering wheel rotated on its own axis anyways as not all steering wheels are completely vertical or horizontal, can we get that fixed before you push the next update please.
     
  13. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hi. Could you please add more details about your problem? The code itself always works in the object's local rotation, as you can see in the following image.


    @@ I just realized that the code has redundancy. I'll remove the redundant patch in the next update.

     
  14. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    new vehicle! It will be available as of the next update.

     
    iichiversii likes this.
  15. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    I’m not a coder so I can’t read it unfortunately, the issue I’m having is my steering wheel is positioned at a 45 degree angle, however the axes the steering wheel uses seems to be the world axes rather than the axes of the steering wheel itself, I can make a video later if you wish?
     
  16. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    That would be very good. It would help me a lot to clarify your question.
     
  17. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    <iframe width="560" height="315" src="
    " frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
     
  18. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello. Could it be possible for me to have access to this 3D model or project?

    It does not make sense for the object to rotate on the global axis.
     
  19. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    So it is meant to rotate on its own axis rather than the world axis, I think I may know why this is happening and I’ll test tomorrow and let you know
     
  20. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    It seems to work fine when I use the Y axis, I had to preposition the steering wheels axis, not sure why its not working on the x axis however.
     
  21. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    The X axis undergoes some unit conversions, so it's a bit tricky to work with.
    So I left only the options Y and Z as possible, as shown in the image below:

     
  22. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Marco I am having another issue, I see since you updated the plugin the ObjectMaster has been completely removed from the speedometer prefab, it seems to be completely different and I cant seem to get it working, Once I apply the speedometer prefab I can not find anywhere to apply the gauges, Is there any documentation available on how to apply gauges and UI?
     
  23. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello. The new speedometer system for the vehicle is simpler to implement.

    Simply put the prefab 'Canvas_Gauges' as the child of your vehicle, and then associate this prefab with the variable 'Speedometer> GaugesPrefab'.

    If you do this, everything should already work automatically.

    If you have difficulties or suggestions for me to improve the system, feel free to say so. I want to make this system simple and intuitive.
     
  24. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    The variables are not there anymore, that's where I am having difficulty
     

    Attached Files:

  25. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Oh wait, I see what you mean, that's not going to work for me, With the older system you had in place I was able to move the Speedometer to a custom position, I see now it is automatically positioned for the camera, I really need to customize where I can put each UI in the virtual space, is this not possible anymore?
     
    Marcos-Schultz likes this.
  26. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Just so you know the older system you had for the gauges was very VR friendly, this new system is completely the opposite, If it isn't possible to move UI to where its needed can we please have it back, it was also possible to view the UI in edit mode, now its only visible in runtime, this was a feature I found to be much better than this newer system.
     
    Marcos-Schultz likes this.
  27. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Thank you very much for the feedback. It is good to know the problems that the updates sometimes bring.

    I will lightly reshape this system to be compatible with the 2 options, a ready speedometer or a system equal to the old one.
     
    iichiversii likes this.
  28. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Marcos that would be great, thank you so much, the old speedometer system was very VR friendly, my project is entirely done in VR, the new system breaks that feature, looking forward to your future updates, well done so far.
     
    Marcos-Schultz likes this.
  29. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    The system has been greatly improved. Now it is even possible to decide which model of speedometer you will use.
    You may decide not to use any, use one or even both at the same time.



     
    iichiversii likes this.
  30. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Fantastic, looking forward to the update
     
  31. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Version 3.3.3 is already available in the asset store.

    ...............[Version 3.3.3]...............
    - The speedometer system has been improved and a new speedometer style has been added. Now you can decide which style of speedometer you want to use, or even use both styles at the same time.
    - Minor bugs regarding vehicle fuel have been fixed and some improvements have been made.
    - Several prefabs have been adjusted and improved.
     
    iichiversii likes this.
  32. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Marco, you have the UI for the speedometer and rpms attached on the same texture, before they were separate, is it possible to have them separate again please.
     

    Attached Files:

  33. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello, the system lets you work with one or several textures because it does not matter where the pointer is located. You can replace the background texture by 2 if you want, and everything will work just fine.

    Do you think I need to make a separate template and insert it in the next update? If I have to, I can arrange it.
     
    iichiversii likes this.
  34. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Ah that makes sense, I just tested and works great, Thank you Marco, I'm having an issue with the suspension heights, it maybe an easy fix but I cant figure out whats going on, I will post a video shortly for you to see my issue?
     
  35. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    <iframe width="560" height="315" src="
    " frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
     
    Marcos-Schultz likes this.
  36. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello. This problem is a bit strange, but I believe it's related to the mass center of the vehicle. If the vehicle colliders are disproportionate or are not well aligned, the vehicle will tilt.

    Another thing, you're adjusting the center of mass of the vehicle during the game. This has no practical effect since the center of mass is computed only at the beginning of the scene to avoid unnecessary processing (this optimizes the system and makes it lighter).

    Another point to note is the variable 'ForceAppPointDistance'. Whenever I used negative values for this variable, the force on the suspension turned out to be uneven, and you're using -0.25

    One more thing, your 'SuspensionHardness' variable is too low. For a heavy vehicle as a tank, a minimum value would be around 70000.
     
  37. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    OK I did some changes to what you mentioned and saw some improvements, however my vehicle is turning to the right as soon as I move forward, I checked the alignment of the wheels to the COG and found them to be set perfectly,Note there is no warning in the Console, this only happens when I accelerate, any idea what is happening here?

    <iframe width="560" height="315" src="
    " frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
     
    Marcos-Schultz likes this.
  38. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hi. This probably occurs because your vehicle is not built in an aligned way. The wheels may not be properly aligned with the vehicle's colliders, and the center of mass may be out of the center.

    Vehicles are usually built with a giant precision, the wheels are aligned and are always symmetrical, otherwise the vehicle begins to spend more of the peneus on one side than the other, and so on. This is why it is always very important to always leave the wheels, colliders and center of mass of the vehicle will symmetrical.

    As for the problem mentioned in the video, it probably happens because of the steering assist. When the vehicle is not symmetrical, the assist will try to compensate for the misalignment. To solve this, just leave the variable 'SteeringWheel> SteeringAssist' at 0.
     
    iichiversii likes this.
  39. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    I went back, checked over and over the behavior of the wheels, believe it or not it was an xbox controller issue, not on your end, The controller seems to be pushing the wheels to the right without any input
     
    Marcos-Schultz likes this.
  40. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Marco I see you have a suspension demo system in this update, is there variables to add my own suspension assets or is this just a sneak peak?
     
    Marcos-Schultz likes this.
  41. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello. The system is a preview, but it already supports other 3D models.



    As you can see in the image, I created an object representing the spring (with the pivot in the corner) and added the component (MSVSSuspensionSpring).

    After that, you just have to correctly associate the components and objects with their proper variables, and things should work.

    This system was introduced a short time ago, so it is fairly new. I'm waiting for feedback from users to learn how to improve this system.
     
    iichiversii likes this.
  42. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Ah yes, i see, thank you Marcos, I will test this this evening.
     
    Marcos-Schultz likes this.
  43. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    I love it, I noticed it stretches the suspension, really clever idea, I do have a suggestion to improve the concept, let me explain, What if you could place an game object at the bottom of the spring that stays central to the wheel, for example a disc that doesn't rotate with the wheel, this will then open opportunities to future proof different types of complex wheel designs like the image I attached. skarab___mars_rover___rear_by_secap_d9zbplm-pre.jpg SUSPENSION_SUGGESTION.PNG
     
    Marcos-Schultz likes this.
  44. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    I should of said if we could place our own game asset at the end of the suspension system, that would be a great feature
     
  45. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Hello, this is already possible, but it requires some tweaking.

    I need to pack some 3D models with separate suspension to test the system and upgrade it. For now, I need to create 2 fixed points to act in conjunction with the suspension.
     
    iichiversii likes this.
  46. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Is there any plan to add support for a gear stick animation like for the steering wheel? I would like to see my gear stick shift between the gears
     
  47. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    107
    Any way of solving this issue?
     

    Attached Files:

  48. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Yes, but not too soon. There are some other demands with a little more priority.
     
  49. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    293
    Currently the only solution is a 3D wheel from the @NWHCoding

    The 3D wheel performs well and supports 3D collisions, but will not fit with other vehicle controllers that exist in the Assets Store, only to the official driver (NWH Vehicle Physics).

    Also, the wheel turns out to be somewhat unstable because it does not support substeps, but this can be adjusted if you slightly lower your TimeStep to work at 60Hz or a bit more.

    If this problem is something that really bothers you, the only current solution is the NWH asset. But if it is something that is not so urgent, the standard wheelCollider will already do well in most situations.
     
    NWHCoding likes this.
  50. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    140
    This looks like a very good asset! There are 2 issues I have right now though, with one of them being pretty critical.

    1. You can't add vehicles at runtime. Attempting to change the code is harder than it looks because of the initialization order of the mscenecontroller script and the vehicle script. This is critical. If you put 0 vehicles in the controller, it won't initialize. If you spawn the controller and vehicle at the same time, it won't work because of script execution. If you execute the initialization code in Start instead of Awake in the mscenecontroller, it won't work either. Any hints as to where I should go and change the code to work with runtime spawns of vehicles?

    2. Deformation doesn't seem to work properly with custom models.You can see in the pic below that the mesh was thrown backwards without modifying the object's position (still at 0,0,0). At first I thought it was because the meshes are scaled to 100, but even with a scale of 1 this still occurs. Also, the speed of impact seems to affect the distance at which the whole mesh moves. This doesn't really bother me as I never really wanted deformation.

    The MSSceneController affects many other things it probably shouldn't, such as setting the player inactive, setting the timescale to 1 on awake or modifying the audio listener's volume. So unless the game you use is purely a racing game that you just started on an empty project, you'll need to modify some scripts to make it work the way you want to.

    https://puu.sh/DGOXl/5bfe3e483e.jpg
     
    Last edited: Jun 16, 2019
    Marcos-Schultz likes this.