Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    I
    Is it support for mobile platforms ? I really want to use it for mobile !
     
  2. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    I tested it briefly, but I still have to make some optimizations as the performance is poor.
     
  3. cg_destro

    cg_destro

    Joined:
    Aug 13, 2013
    Posts:
    142
    ooo hell yeah! :) damage looks super awsome! me want! :D
     
  4. StephenL

    StephenL

    Joined:
    Oct 18, 2010
    Posts:
    218
    Awesome!
     
  5. toadie-festino

    toadie-festino

    Joined:
    Nov 5, 2013
    Posts:
    6
    Hi, I've bought the package and so far so good. One thing that I can't seem to figure out is when restarting the scene, either your demo or my own scene with your package.. it restarts alot darker than the original settings. This is ruining my project at the moment, no matter if i use the restart option you included or I create my own script with an Application.LoadLevel(1); element, the same thing happens.

    Any ideas?


    Edit> I Found a solution 5 mins after posting.. typical, but leaving this here for anyone who stumbles upon... If you go to the new Lighting window in Unity 5 and turn off continuous baking, then build the scene. the artifacts above are fixed.

    Regards
     
    Last edited: May 14, 2015
  6. HakJak

    HakJak

    Joined:
    Dec 2, 2014
    Posts:
    192
    OMG I'M SO EXCITED!!!!!
     
  7. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Hey, I noticed cars leave garbage game objects when they are unspawned, could you add this to the VehicleParent script, please?

    void OnDestroy()
    {
    if (norm != null)
    Destroy(norm.gameObject);
    }


    Tks
     
  8. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Mmm similar issue with CameraControl. If for some reason Initialize is called several times, lookObj is recreated. Something like this would be better, i guess:

    public void Initialize()
    {
    //lookObj is an object used to help position and rotate the camera
    if (lookObj == null)
    lookObj = new GameObject("Camera Looker").transform;
    .....

    Tks
     
  9. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    I'll clean them up in the coming update, I think I can still have it done by the end of the month.
     
  10. Hitch42

    Hitch42

    Joined:
    May 12, 2015
    Posts:
    98
    You mentioned that you were having trouble making bike physics work. Are bikes still a feature that you plan to include, or has that proved troublesome enough for you to abandon it?

    Also—and I'm not sure if this is outside the scope of what you want this asset to be—but would you implement additional particle effects to the vehicles? I'm thinking of things like car exhaust, tires smoking when they skid, sparks flying when vehicles crash, and wheels kicking up dirt, mud, or water when they drive over those terrains.
     
  11. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    Bikes aren't completely abandoned, but they're pretty much at the bottom of the priority list.

    With the damage update I'm adding some particles. Just tire smoke/mud particles, glass particles, sparks on collision (not continuous scraping), and engine smoke when it's heavily damaged.
     
  12. JayG81

    JayG81

    Joined:
    Sep 4, 2012
    Posts:
    72
    Can't wait to get my hands on this. I've been using RVP1 for my game Power Drive 2000, but will be using this when I finally upgrade to Unity 5. I'm pretty excited about all the new features. Keep up the excellent work!
     
  13. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Yes. When you finish your game. You shoud credits RandomationGames into your game.
     
  14. JayG81

    JayG81

    Joined:
    Sep 4, 2012
    Posts:
    72
    Of course, I will credit the creators of all the assets I've used. There is some great stuff on the Unity asset store and they really help with the production of the game.
     
  15. liverolA

    liverolA

    Joined:
    Feb 10, 2009
    Posts:
    347
    So we will see the dmg system in this week? LOL
     
  16. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    I don't know, but the package is pretty much ready to submit. I just have to update the documentation, make a video showcasing the damage, and update the storefront's images and description. I'm aiming to submit it either today or tomorrow, but I don't know if it will make it through the review process by the end of the month.
     
  17. liverolA

    liverolA

    Joined:
    Feb 10, 2009
    Posts:
    347
    got it.
    It will take about a week before show on the assetstore.
    Good news that you finished it.
    the dmg system is really cool !
     
  18. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    Best vehicle physics package out there, and yes we'll be using it for Monster Truck Racing Arenas!

    Mobile performance is good, I didn't see any framerate drops between having 1 vehicle and 4 vehicles in my scene.
     
  19. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    That's good to hear, my phone is pretty weak and is the only mobile device I can test on.

    The package has been submitted. As usual, once it's approved I'll release the demo, video, manual, and changelog.
     
  20. liverolA

    liverolA

    Joined:
    Feb 10, 2009
    Posts:
    347
  21. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    I have to ask, what is so funny?
     
    Meltdown likes this.
  22. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Did you tested it with 6 - 8 vehicles in a scene ? I did test with 6 vehicles only, but seem performance not good. Although i did optimized my 3d models scene with very very low poly. But still not good. I hope RandomationGames will optimized performance for mobile platforms.
     
  23. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    One of the biggest bottlenecks is the wheel raycasts, but as far as I know there isn't a way to optimize it.
     
  24. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Why you don't use new WheelCollider of Unity 5 like you use in RVP 1.x. Its seem best performance with Physics SDK 3.0 ?
     
  25. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    The wheel friction calculations in RVP 1.x were hacky and messy, mainly because the wheel colliders were hard to work with. Then the Unity 5 beta came along only to break the behavior of wheel colliders from Unity 4.x. After that, I decided it was best to develop my own wheel colliders that don't depend on the PhysX ones. Now I have my own wheel solution that can theoretically be ported to other physics engines, as long as they have some raycast equivalent. (I'm not planning on attempting to port RVP, but at least the option is more feasible in case I decide to try other engines.)

    Plus, when a bug shows up, I can actually look at the code that makes the wheels drive, rather than trying to figure out what variables make the wheel colliders tick.
     
  26. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I'm having a small issue that's been bothering me for a while. Every second or third jump or so my truck's wheels seem to 'flicker' or move up and down extremely quickly. Take a look at this video...

    At 0:02, right after the truck launches from the second jump, observe how the wheels all shake/vibrate up and down very quickly. Any idea how I can resolve this?

    Thanks

     
  27. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    It looks like the travel distance of the wheel is not adjusting properly when the wheel leaves the ground. The wheel appears to be moving correctly when on the ground, but as soon as it leaves the ground, it thinks the suspension was fully compressed, but then extends fully to the correct distance.

    Open up the Suspension script and find the line where travelDist is set. Comment that out and replace it with this:

    Code (csharp):
    1. travelDist = suspensionParent.compression;
    I can't tell the exact line number since the script is longer in the new update, and I neglected to keep a copy of the old version. This modification removes the smooth extending of suspensions.
     
  28. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    travelDist isn't set anywhere in the Suspension script.

    I can only find it being set it two places in Wheel.cs

    Code (CSharp):
    1. travelDist = suspensionParent.targetCompression;
    and

    Code (CSharp):
    1. travelDist = suspensionParent.compression < travelDist || grounded ? suspensionParent.compression : Mathf.Lerp(travelDist, suspensionParent.compression, suspensionParent.extendSpeed * Time.fixedDeltaTime);
    I have tried setting one or both to the line you mention, and I still have the problem.
     
  29. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    Sorry, it was the Wheel script, and the second travelDist instance that needed to change. The Suspension script just computes some vectors and applies the suspension force, the wheel script is what actually positions the wheel. I've been a little frazzled lately.

    Maybe try going down to the PositionWheel() function in Wheel.cs, and commenting out the three lines under the one where rim.position is set. Also make sure to remove the + sign and add a semicolon at the end of the first one.

    Another thing, I'm going to be away from my development PC for the weekend, so I can't look at code during that time. I can still try to answer questions.
     
  30. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    Nope, still doesn't make any difference
     
  31. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    Ok, would it be possible for you to send me a stripped-down version of the scene with the vehicle causing the problem? I've never seen this happen and don't know what could be causing it.
     
  32. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Hey, another small fix you might want to integrate in the next version.

    In TireMarksCreate.cs, line 202, sometimes i get an error related to the fact that you are trying to compute normals on a mesh for which you haven't assigned any triangles. I simply commented out the CalculatNormals for now, but you might want to fix this properly.

    Tks
     
  33. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    I haven't seen this error, what was the vehicle doing when this happened?

    On anther note, version 2.02 has been released.



    I still have to find a way to add scratches on the vehicles. The damageable vehicle example is more complicated than what most games need, it was made that way for demonstration. The blend file can be found in the blend models zipped folder. I'll probably add more damageable vehicles later on.

    The manual has a new section on changing the performance of vehicles with the formula for calculating top speed:

    max RPM of engine / last gear ratio of transmission / (Pi * 100) * circumference of driven wheels

    Changelog:

    Added support for damage with the VehicleDamage, DetachablePart, and ShatterPart scripts.

    Added damageable muscle car.

    Wheels can now detach.

    New “Tires Bumped” shader.

    Loose objects are deleted when vehicles are deleted.

    Raycasts hit triggers set to false so that vehicles can't drive on triggers.

    Car Body physic material is slightly bouncier.

    New Detachable Part layer.

    The compressor effect on the master audio mixer has been moved to the SFX mixer.

    Gravity on inputs in the input manager have been adjusted.

    Refactored some repeat GetComponent calls into one.

    Tweaked performance of most vehicles to accommodate bug fixes in Suspension and transmissions.

    VehicleParent – Burnouts have been smoothed a bit with the new burnout smoothness variable.

    Wheel – Added Deflate(), FixTire(), Detach(), and Reattach() functions. Added damage variables. Added rim glow variable for making rims glow while scraping. Various improvements to burnouts. GetRawRPM() constant changed from 300 to Pi * 100.

    Suspension – Added damage variables. Fixed bug in how suspension forces were applied. To keep legacy behavior, set the new variable “Apply force at ground contact” to false. The bug manifested itself as vehicles leaning forward at high speed.

    SuspensionPart – New invert rotation variable to invert the local z-rotation of solid axles.

    VehicleDebug – Damaged vehicles repair on reset and WaitForFixedUpdate coroutines with resetting.

    TireMarkCreate – Smoke/debris particles.

    TireScreech – Fixed bug in the volume of sounds, where integers were being divided instead of floats.

    SteeringControl – Added support for rotating an actual steering wheel.

    HoverSteer – Added support for rotating an actual steering wheel.

    Transmission – Damage variables. Fixed bug with torque output, set the new “Legacy Torque Multiplier” variable to true to maintain old behavior. The bug prevented vehicles from reaching their maximum engine RPM at top speed.

    GearboxTransmission – Added GetFirstGear() function and damage logic.

    ContinuousTransmission – Damage.

    Motor – Damage variables. Smoke particles to represent damage.

    GasMotor– Damage and changes to burnout logic. New GetMaxRPM() function.

    HoverMotor – Damage.

    HoverWheel – Damage variables. Added Detach() and Reattach() functions.

    VehicleMenu – Limit how quickly chase cars can be spawned. New button for spawning damageable chase car.

    GlobalControl – New layermask for objects that can inflict damage.

    GroundSurfaceMaster – Added leave sparks property to surface types.

    CameraControl – Initialize() doesn't leak objects anymore.

    MobileInputGet – New delta factor variable for how much the input's rate of change is added to the input.

    FollowAI – New InitializeTarget() function and WaitForFixedUpdate coroutines with resetting.
     
    Last edited: Jun 2, 2015
  34. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    The error itself is very erratic. I have it on one machine, but not on the other, and it happens without doing anything so special to the car (just driving around grounded). To be honest I didn't investigate much, but my guess is that the tire marks would kick on and off very rapidely for some reason. In any case, the error reports that you can't recompute normals on a point or line mesh, and looking at the code in UpdateMark(), the first time around gapDelay is not 0, so the mesh can exist without triangles. Having at least a check for that befor recomputing normals wouldn't hurt
     
  35. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Btw, congrats on the new release. I really love your stuff! Keep up the good work!
     
  36. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    I will add a check for this, and thanks.

    Another thing I forgot to mention is that there is no damageable vehicle in the mobile demo because it is too complex to perform well. In the future I'll add a simpler vehicle for it.
     
  37. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I've just stripped everything down from my project, and about to send it to you, but now it doesn't seem to happen when the whole scene is stripped down with no textures.. weird. I'll see if I can isolate the cause :(
     
  38. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    Good luck with that.

    On another note, a minor update is coming soon with improved performance for damage. This will alleviate the issue with driving up steep slopes and experiencing severe lag due to too many collisions being accounted for with all of the sub-colliders.
     
    CoderPro likes this.
  39. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Hope you make damage system for mobile system. I think, its only need very simple simulation. And improve performance of vehicle physics for mobile, too.
     
  40. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    I was just making some small changes to the suspension script and noticed that I experienced a similar issue when the target compression was less than 1. The target compression is meant only for visualizing suspension travel in edit mode, and should be left at 1 in play mode. I'm going to add a line to the script forcing it to be 1 in play mode.
     
  41. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    Mine is already set to 1 on all suspensions :(
     
  42. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    Update 2.03 has been submitted for review.

    I don't know what to say then, I guess keep trying to isolate it if you can. Maybe restart the stripping down process and try to catch it?
     
  43. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I got it fixed! I had some of the Ground Mask layers for the wheel set to invalid or incorrect layers. I have just set it to Vehicles and to my GroundSurface layers and all is working good :)

    Also would it be possible to allow purchased users to download an updated package that doesn't take over all your project settings and layers every time? It's really invasive when importing your project and it does this, players should rather set their own layers or follow a tutorial.
     
  44. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I'm having another issue, if I set the engine power to 5.0, the vehicle has inconsistent engine power, sometimes it accelerates like a 5.0 engine power should, but many times it just stays really slow. Any tips on how to resolve this?

    Alternately, how would you suggest I improve the top speed of a vehicle if engine power is not the way to go?

    Also how would you suggest is the best way to increase/decrease the acceleration of a vehicle, for instance in an upgrade shop, when they buy an acceleration upgrade, which setting would you recommend I increase to improve acceleration?
     
    Last edited: Jun 7, 2015
  45. HakJak

    HakJak

    Joined:
    Dec 2, 2014
    Posts:
    192
    Hi
    Just un-check the items you don't want to import when you do an update. Most of the Project Settings items are first on the list (the ones with the gear icons). Unless there were explicit changes made to these in the last update (which Randomation does a great job of cataloging and posting), you shouldn't need to re-import them again.
     
  46. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    Pretty much this.

    In 2.02 I added a section to the manual titled "Changing Performance" with info on how to adjust acceleration and top speed. Having the acceleration be too great can cause the wheels to slip and spin too fast, causing the transmission to upshift to compensate. This can be prevented by increasing the forward friction of the wheels.
     
  47. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Hi RandomationGames,

    Could you add a sample car that like Drag Racing game ? I hope you will make a system for Drag Racing game.

    Many Thanks.
     
  48. JustInvoke

    JustInvoke

    Joined:
    Jul 16, 2012
    Posts:
    375
    There is already a drag racer, I'm not sure what you mean by "that drag racing game".
     
  49. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I'm well aware I can do that but I still think it's bad practice that a package changes all your project and input settings etc.
     
  50. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    I known have Dragster vehicle. But i want to make a system like in game CSR Racing, or other Drag Racing game. Its mean Gear of cars will be shift by user and not automatic. Increase or Discrease gear of car will be controll by your selft and not automatic.