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

Edy's Vehicle Physics - official thread

Discussion in 'Assets and Asset Store' started by Edy, Jan 19, 2012.

  1. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    Ok, I see the problem. I assume the latest picture are the non-trigger colliders, right?

    The number one rule for WheelColliders is: ensure the top half of each WheelCollider component is inside the vehicle's non-trigger colliders. The pic below is from Vehicle Physics Pro (https://vehiclephysics.com/user-guide/3d-models/#vehicle-collider) but you get the point:



    Other than that, I wonder if resembling the vehicle's shape in such detail with box colliders is really necessary. Such setups may cause many problems on the vehicle getting stuck in the scenery, or other objects getting stuck inside the vehicle. Here's an example of what can happen when using such detailed collider setup in PUBG:

    Source: https://www.reddit.com/r/PUBGMobile/comments/aqg8h8/im_quite_proud_of_our_vehicle_physics_brendan/ (click to see the animation):

    upload_2019-2-28_12-18-52.png

    The best collider setup for a vehicle is either a convex shape enclosing it, or several overlapping convex shapes for better fitting to the geometry. The "overlapping" part is important as prevents other objects to get stuck in the middle of two colliders. The picture below shows a car with two convex colliders that are partially overlapped, which is correct:

    upload_2019-2-28_12-21-54.png
     
    Mr_Dan_O, sharkapps and devotid like this.
  2. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,544
    When I try to use Unity's FreeLookCameraRig the car stutters like crazy. Any idea how to prevent that? I already disabled Vehicle View Config.

    Looks like this, click thumbnail to see it animated:

    edy.gif
     
  3. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    421
    Try setting the cameras rigidbody to "interpolate" (if there is one on it.). That should smooth it out. The vehicles in Edy Physics have their RB set to interpolate to make em super smooth.
     
    Edy likes this.
  4. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,544
    The camera doesn't have one, but the FreeLookCameraRig has one. And that's set to Interpolate. But setting the car's Rigidbody to Interpolate None helped. In case you have another suggestion, I'd like to try it, super smoothness is what i want :D
     
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    It looks like that camera rig has not interpolation and/or the movement is processed in FixedUpdate, not in Update or LateUpdate. The super smoothness requires:
    • Car's rigidbody interpolation enabled
    • Camera movements processed in Update or LateUpdate (the latest is more correct).
    • Camera using the vehicle's transform.position as reference of rotation, or looking at, or whatever the nature of the camera is (i.e not using rigidbody.position nor any other physics-based component as reference).
    • May be required by the nature of the camera: smooth movement using Lerp/Slerp and Time.deltaTime.
     
    sharkapps and Rowlan like this.
  6. EIEE_assetstore

    EIEE_assetstore

    Joined:
    Mar 1, 2019
    Posts:
    1
    Hi Edy and oxydozg. I am using the EVP in my project with a Logitech G920. I need to apply Forcefeedback to the steering wheel using a constant force. How can I do this? What force, and where can I find that force(s) that I can use for this task? Thanks.
     
    Rowlan likes this.
  7. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,544
    Is there a way to prevent the particles going inside the car? Also the particles aren't affected by light, they are always bright, so at night they are white. How can I prevent this?

    My scene currently looks like this and the smoke particles in the car are a bit distracting:



    Thanks for the help!
     
  8. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,544
    Additional note: It would be really awesome if you guys could make a tutorial about how to rig a car from scratch with Edy's. It's been a pain to do so, lots of problems. The documentation is only a white page currently. A video using the current version of Edy's would be great. Other people have the same problem and keep asking me now how I did it, but I rather prefer the publisher would do this. Thanks for the consideration.
     
  9. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,544
    @Edy Will you guys create an updated documentation / video about how to rig a car model with Edy's? People keep asking me how to do that.
     
  10. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    @Rowlan, this video shows the process from scratch to the working vehicle:

     
  11. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    Particles are standard Unity particles so you may configure the Particle System in the way you want. In this case you may play with the Collision section of the Particle System component:

    upload_2019-3-7_13-43-5.png
     
  12. daniozi117

    daniozi117

    Joined:
    Mar 4, 2016
    Posts:
    27
    Hi!
    I have a problem related to wheels meshes Transform. When enter in trigger wheel meshes are not on correct position even though wheel colliders are on correct place where they have to be. Using all methods of triggers OnTriggerEnter, OnTriggerStay and OnTriggerExit. So any suggestion from your side ...
     

    Attached Files:

  13. lukeluzardo

    lukeluzardo

    Joined:
    Dec 9, 2017
    Posts:
    22
    hi im planning on building a bulldozer with this asset and i need a way to setup the tracks can anyone tell me please
     
  14. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
  15. lukeluzardo

    lukeluzardo

    Joined:
    Dec 9, 2017
    Posts:
    22
    edy i sent and email to you check your mail to find my email
     
  16. lukeluzardo

    lukeluzardo

    Joined:
    Dec 9, 2017
    Posts:
    22
    edy can you make me a track script for my bulldozer please
     
  17. ZenMicro

    ZenMicro

    Joined:
    Aug 9, 2015
    Posts:
    206
    Hi Edy, Can you report on your plans for Gears weather Auto or Manual over what currently is in place which is just the EVPAudio.simulatedGear? are you still planning to implement or is this abandoned?

    If it's done with, has anybody else written a script to handle actual gears (cutting power during a shift etc)?

    Cheers
     
    Last edited: Mar 28, 2019
  18. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    Hi @Edy, do you know what could be causing this behavior with skidmarks on Unity 2018.3? I am working on a branch of a project that I updated from Unity 2017.3 to 2018.3.10f1. I inserted pauses in the video where the errant skidmarks appear.

     
  19. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    Yes, it's a bug in the skidmarks code. It comes from a discrepancy between the physics contact point and the visual contact point. It will be fixed in the next update. Thanks for reporting!

    Meanwhile, as workaround you can configure Wheel Position Mode = Fast in the advanced settings. This will remove the issue.

    upload_2019-4-4_12-55-53.png
     
    sharkapps likes this.
  20. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    This resolves the issue for me. Enjoying your twitter posts, btw! Thanks again.
     
  21. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    110
    What would be the easiest way to set up the tire smoke to show up on handbrake skid marks? Ive noticed it only shows up when the wheels dont have traction, but not when the handbrake skids happen. Tire marks are fine, I would just like to include tire marks + tire smoke.

    Thanks
     
  22. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Would it be possible with Edy's Vechicle Physics to set up a weird suspension that would work in this sci-fi vehicle (from the asset store):


    That asset comes with a simple physics setup with a suspension that just moves the wheels with terrain. The elaborately modeled suspension pieces are then static. Ideally the lower pieces that attach to two wheels each would rotate and the big upper suspension bar things would react at least somewhat to terrain.

    If that's not a good fit for Edy's, is there another asset that is more geared toward that sort of thing? I already own Edy's, so of course that was my first thought.
     
  23. lukeluzardo

    lukeluzardo

    Joined:
    Dec 9, 2017
    Posts:
    22
    every time i delete an object with box colliders it gives me an error saying Missing reference exception the object of type box collider has been destroyed
     
  24. buc

    buc

    Joined:
    Apr 22, 2015
    Posts:
    60
    How to network the rear wheels movement?
    I've managed to move the car via network and also the front wheels are moving. But how would you go to have the rear wheels move according to the rigidbody speed?
     
  25. buc

    buc

    Joined:
    Apr 22, 2015
    Posts:
    60
    Still having problems to get the car networked:

    - I've copied the content of VehicleStandardInput into a custom NetworkedInput and adapted it so it can read the input transfered over the network. It's almost all the same code, just instead of Input.GetAxis, inserted the transmitted input values.

    - the car body position gets replicated over the network and the front wheels can steer nicely to left/right

    - but the wheel-spinning is not matching the car's velocity, especially they keep spinning when the car stands still or are not spinning at all when the car moves which looks weird like a sliding car. Which of them occurs depends on when the input occurs.

    I've tried different things: with leaving all at how it was and also by stopping to execute and apply things to rigidbody and wheels if it is not the local-player. Nothing worked. Just poking around without help of the developer this can get frustrating.
     
  26. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    128
    Hello,

    I just boght the asset.

    I understand by reading the forum that the system is coded for 4 Wheels.

    There is anyway to "cheat" and use it to rig a motocycle? (2 wheels)

    I tried to add a other "virtual wheel" to make the motocycle "stand" but with no luck...

    Thank your for your help
     
  27. K1kk0z90_Unity

    K1kk0z90_Unity

    Joined:
    Jun 2, 2013
    Posts:
    84
    Hi @Edy ! :)
    How can I configure the number of gears of the car? I would like to keep the automatic transmission, but show the current gear to the player in the HUD. But I would like to choose how many gears does the car have.
    Thank you in advance! :)
     
  28. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    Gears are computed in the VehicleAudio component, as currently they're used to play the engine audio only.
     
    K1kk0z90_Unity likes this.
  29. K1kk0z90_Unity

    K1kk0z90_Unity

    Joined:
    Jun 2, 2013
    Posts:
    84
    Thank you very much for your answer!
    If I want to change the number of gears for a specific vehicle, can I do it without modifying the source code?
    Thanks again! :)
     
  30. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    Yes, the parameters for the simulated engine and transmission are exposed in the audio component.
     
    K1kk0z90_Unity likes this.
  31. kielinen

    kielinen

    Joined:
    Jul 18, 2016
    Posts:
    22
    Just started to use this add-on and I ran into something odd. The vehicle does not move at all unless the box collider is penetrating into the ground. If I raise the Box collider, the vehicle is not responsive to inputs. Not sure if the vehicle size has any issues, since we are using this on simulated Haul Trucks, these are 7 meters tall and about 250 tons empty. The tires are 13 feet tall. I checked the hierarchy and matches the demo vehicles. Only one exception, when i use Interpolate in rigidbody as demo vehicles, Unity crashes with infinite values? This model is pretty simple (body, 4 wheels) and using Standard Assets, I dont have any issues with physics. Any suggestions?
     
  32. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
  33. Camagine

    Camagine

    Joined:
    Sep 11, 2014
    Posts:
    6
    Silly question. How can i map a button, to put he car in reverse? i have EVP5 and cannot find anything that triggers reverse.
     
  34. rajitgamingyt

    rajitgamingyt

    Joined:
    Jun 21, 2019
    Posts:
    1
    can you provide code so that we can rev up the engine with the press of accelerator even when the vehicle is stopped like in Vehicle Physics Pro demo?
     
  35. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    984
    Can't set up a car with small tires, golf cart actually. I went through the process with a car with normal sized wheels and didn't have this issue. On Play the front of the 'drivetrain' stretches out. Where can I start to troubleshoot this? Also, how do I set the distance in the 2nd Image? Mine always comes in at the elevation of the wheels? Thanks.

    Suspension_02.PNG Suspension_01.PNG
     
  36. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    984
    I'm still working through the issue above. It's not the size of the wheels, but something is wrong with the Front Left wheel. How can I fix this, thanks.

     

    Attached Files:

  37. ajith_sreenivasan

    ajith_sreenivasan

    Joined:
    Aug 29, 2018
    Posts:
    6
    How do I change the size of the car??
     
  38. samadqamar755

    samadqamar755

    Joined:
    Jul 9, 2019
    Posts:
    1
    Hi, i also just purchased this asset. I want to know where the mobile controls are? because i can't find a scene or a prefab for mobile controls. Please reply asap.
     
  39. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    259
    Edy, I'm surprised that you released Vehicle Physics Pro for free. I loaded some scenes into Unity 3D and tried to run them but the steering wheel icon doesn't show up on the left side of the screen. The icon shows up on the left side of the screen on the pickup truck demo that I downloaded from your website. How can I fix the problem?
     
  40. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    259
    Where is the VPDeviceInput script?
     
  41. Mr_Dan_O

    Mr_Dan_O

    Joined:
    Oct 12, 2013
    Posts:
    347
    I have a Wheel Camber-related question @Edy , Imagine we increase the wheel cambers from -0 to -0.5 degrees. How this should affect the wheel colliders? I mean, Should changing the wheel-camber angel affect the wheelcollider properties at all? or does it affect tire friction? What exactly should be done for simulating the effects of wheel cambers? I actually have no idea and looking forward to your reply, Thanks.
     
  42. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    The demos in the website were built with the Professional / Enterprise editions. The free Community edition supports steering wheels through the standard Unity Input class. Here are the instructions for configuring them:

    https://support.vehiclephysics.com/16/logitech-g27wheel-pedal-set-setup

    This component is included in the Professional and Enterprise editions.

    Unity WheelColliders project their raycasts vertically with respect to the rigidbody they belong to. There's no physics effect on modifying the rotation of the wheels. I plan to implement camber as extra parameter to overcome this limitation. There's no date for this feature yet.
     
  43. admin_unity486

    admin_unity486

    Joined:
    Oct 16, 2019
    Posts:
    5
    hey guys i was wondering if anyone knows how you can show and adjust the settings of the car power ect ect while its being played just like what i have here for the camber and ride height thanks guys
     
  44. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    264
    I've always wanted this asset. I see that it is on sale however it hasn't been updated since February 2018. So this still works with no glitches with say 2019.2. I know Edy has the Vehicle Pro for free but he recommends the other for simpler setup/usage. Thanks
     
  45. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,866
    Simply create an UI with an scripts that modifies the car's parameters when the user modifies the UI. All parameters are exposed in EVP, so it would be easy to configure them from an UI.

    Indeed, I'm currently developing and testing it in Unity 2019.2.3f1. You'll only get the auto-upgrade process for the Terrain, which will generate a new folder with the generated terrain tiles.
     
    digiross likes this.
  46. Mr_Dan_O

    Mr_Dan_O

    Joined:
    Oct 12, 2013
    Posts:
    347
    Well, I'm aware of how WC works, I want to manipulate the available values based on the camber. But I don't know if there is a mathematical equation or algorithm for it.

    For example, the only thing I know is the radius and placement of the WheelCollider as shown below, but I don't know what else should I program to get changed when the player changes the wheel camber value. I hope I said it clearly!
    CamberSimulation.jpg
    Notice the upper right and the bottom tires are placed exactly at the same position of X-Axis.
    The green lines are wheelColliders, ofc.
    Kind regards,
    Looking forward to your reply, @Edy :)
     
    Last edited: Oct 20, 2019
  47. Untitl3d

    Untitl3d

    Joined:
    Jun 20, 2019
    Posts:
    7
    Thats interesting question and I also like to know! I dont think the radius of wheel colliders should change but the position should.
     
  48. Mr_Dan_O

    Mr_Dan_O

    Joined:
    Oct 12, 2013
    Posts:
    347
    Good point @Untitl3d, but I disagree with you on not changing the Wheel Colliders' radius.

    Based on the nature of Wheel Collider, we have to resize the radius to take the new dY of the y-component force of the tilted wheel into account. To illustrate it, let's have a look at the image below.
    • The Blue arrow shows the force vector.
    • The Green arrow shows the y-component of the force. It is obvious that the force equals its y-component at first. However, as we're tilting it sideways, the y-component will be F *Cos(Camber angle).
      AFAIK, The Wheel Collider doesn't care about the F, but the y-component. Hence we have to only calculate the component and serve it as the actual force for the Wheel component.
    • The Red rectangle roughly indicates the dY.
    ezgif.com-crop.gif
    I'm not a physicist and these are just my opinion.
    Best.
     
    Last edited: Nov 5, 2019
    Untitl3d likes this.
  49. admin_unity486

    admin_unity486

    Joined:
    Oct 16, 2019
    Posts:
    5
    hey guys i was wonder if someone could help me to display the VehicleController
    settings on the gui im having a hard time figuring it out be much appreciative thanks guys
     
  50. iamtayyab14

    iamtayyab14

    Joined:
    Mar 13, 2019
    Posts:
    1
    Hiii
    I want to sit driver in my car So how can i put driver in car
    help plz
     
unityunity