A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Now in Beta! Get 1:1 live lessons on any Unity topic or help troubleshooting your project – Connect with an expert on Unity Live Help
Discussion in 'Works In Progress' started by NWHCoding, Nov 30, 2017.
Has anyone encountered this before ? Any potential causes ?
Ah, this is related to the job system and really nothing to worry about, but I will see what can be done because otherwise there will be a lot of questions on this one.
I am going to guess that you get this after changing a script while in play mode and with "recompile and continue playing" enabled? Unity job system uses native array which needs to be disposed and I do it when objects are destroyed (e.g. exiting the scene) to prevent allocating the same native arrays each frame. When Unity recompiles the script during the runtime it does not call any of the callbacks, but loads the scripts again, leaving the old native arrays in the memory but without a handle which causes this warning. Will see what I can do about it, and I missed this one since I have disabled the option to recompile and continue playing.
I have just pushed an update to fix this so that reloading the scripts at runtime works fine once again. Expect it in about two to three days. If anybody needs it sooner send me an email.
That's awesome, I can wait for the update in the next days.
Update is out.
I have included a development version of multiplayer in Scenes/Photon Multiplayer folder so you can try it out if you want - just check the readme first (in the same folder).
Did you get my last e-mail?
Got it and will see what I can do about the things.
Can this asset be adapted for using ai?
It can. The vehicles are using what I call 'input state' system where the vehicle only holds the value of the inputs but does not set them, that is done externally through different input managers. Also, all behavior can be controlled with just horizontal and vertical input (normalized).
So, by setting those two:
You can control your AI car. If you need to set exact steer angle just set high and low speed steering angles to same value and treat the horizontal value as percentage of the angle, e.g.:
steerAngle = 10f;
vehicleController.input.horizontal = steerAngle / vehicleController.steering.lowSpeedSteerAngle;
Where steerAngle is your requested steer angle.
Add vehicle reverse sound effect. OK?
As in beeping?
Hey, sent you an e-mail but didn't hear back.
It's from the game Burnout. When you drive close to obstacles you collect boost. Once the boost hits a 100% you can hit a special key to make the car drive extremely fast. Like here:
The tricky part is rather to keep the car stable and to have a special camera lens effect
Any news on the "ATV/Rally Car" of the TODO list?
Or could you recommend one from the Asset Store which works with your asset?
Currently I am working on another project, after that I will roll it up in a larger update. Currently waiting for the feedback on multiplayer.
More of a (beginner) best practice question than a tech one regarding NWH.
The game will have a main car (detailed model) and traffic cars (low poly / lower quality).
The player can switch between his cars at runtime but I'd like to keep only the car he uses at that moment in memory (vram / textures). Any tips on how to optimally do this ? From what I've read there are 2 options for loading prefabs, Resources or AssetBundles, what would you recommend in this scenario ?
First, I must say I am not the definitive expert on resources vs asset bundles. I prefer to use resources since I find them a lot easier, but if you are streaming objects over the network then I would choose AssetBundles.
I would just google around a bit and compare one vs the other, there have almost been books written on the topic considering how much this is discussed, and vehicles are no different to any other game object.
Thanks for answering my email. Wow. Your package is going to be one of the best if you keep working like this. A hard-working man and you are listening to the community. I want to use it for drifting. Can't wait for a demo scene.
I own Wheel Controller 3D. I read in your product description that you offer upgrade options for NWH Vehicle Physics.
Could you please let me know how to upgrade?
Go to the NWH Vehicle Physics asset store site and you will see a discount. That is all there is to it.
How do I disable sounds for the vehicles? I have player and ai vehicles in my scene and unity complains that there are multiple audio listeners in the scene.
You are getting that warning because you have multiple LISTENERS (usually cameras) active at the same time, not audio sources.
So far so good. Just missing terrain data in Photon scene after import asset in unity 2018 3.6.f1. Added terrain manually, not big deal, and run scenes from editor and game in result both vehicles spawned wrong, one on the ground, second a in a miter above, and their movement not visible to each others. (Demo from here working fine with terrain, etc)
Its about Monster Track, sedan has issues another issues as well. Can't figure out why, anybody tried Photon scene?
Will check it out. Planning to finalize the Photon code soon enough anyway after receiving the input.
There is really no reason for them to spawn at different positions BUT currently all the vehicles are spawned at same point which could be that they spawn one on top of another because of that.
I understand, its required lots of coding, etc. still be nice to have two cars Monster Truck and Sedan Merc E 240 to spawn at different location, not on top of each others LOL.
+ Just simple request to post here your (master) MultiplayerCar2 and MultiplayerCar1 screenshots, in imported asset some scripts missing.
Above I modified Photon View to add Observed Components, and vehicle become visible for opponent. I hope I did it right. (Used Realistic one and did like he did)
BTW I read that you want to keep some particular vehicle models, I can offer you all required details about latest 2019 hybrid (electrical with gasoline switch) with sport mode, its GLC 350e 4MATIC, inline-4 turbo + 85kW electric motor - like screenshots of dashboard, engine, interior, etc. its one of the best model in the market.
OMG new issues again, in Island demo in Unity 2018 after imported asset all cars underground at half.
Looks like your code is ok, just asset not compatable with latest unity as you reported in asset description.
And something broken as you can see in attached screenshot, may be ground detection, would you please help me to fix it if you willing to maintain this asset, or you already got another contract as you mentioned and planning to drop support of that great (even I can say the best vehicle system)?
I will have to say that the problem is somewhere on your side since the asset has been submitted using (screenshot from asset page):
Last update works ONLY with 2018.3 and later so it is not true to say the least that new versions of Unity are not supported when they are mandatory to get the multi threaded raycasting.
To make sure they did not break anything I did a clean install of 2018.3.6f1 which is about as new as it gets without going into beta versions and did a clean import of the asset from the asset store. Works as expected (terrain is missing from beta multiplayer scene and I am aware of that):
Screenshot after clean install and clean import without any settings changes or anything, have not even followed the readme. Just opened the demo scene and pressed play and this is what I get (it is dark because I have not baked lighting):
I would recommend doing a reimport of the asset and seeing if that helps. Make sure you are not using version 1.9 with Unity 2018.2 or earlier (which is impossible if you got the asset from the asset store) or it will not work.
You absolutely right, you did proper unit testing, I know, much appreciate it. No worries about words in asset description.
Pure import to Unity 2018.3.6f1 Island Demo working fine, no problem at all.
The issue in WheelController3D and VehicleController scripts in #if PHOTON_MULTIPLAYER statement.
To replicate just add PHOTON_MULTIPLAYE to Scripting define statement, and Photon Demo scene start working fine and non photon scene become with errors, it can be unity issues.
As workarownd (till your review) I'll try to dup WheelController3D rename it to WheelController3D_MP with photon section and remove all photon refs from WheelController3D, that will works for sure, just don't understand why.
So the bottom line for non photon scenes if "Scripting define statement" -photon enable - Island scene stop working (multiplayer working), as soon as I removed "Scripting define statement" -photon enable, Island working fine no errors.
Ah, thank you for the clarification.
The issue is most likely in the fact that when photon is enabled I immediately stop doing local ground detection and actually rely on the data from the server to position the vehicles. Vehicles that go over the network are pretty much dead and do not do much themselves (which is the goal) and setting the photon define statement makes them think they are networked - which in the case of the island scene they are not.
Is there a way to simulate air resistance ( a drag factor that increases with speed squared ) ?
Scenario : Taking 2 vehicles with similar power / weight / transmission ratios, one is a small vehicle and the other one is a van. As they speed up the van should accelerate much slower than the smaller car hitting the top speed much sooner.
That is exactly what rigidbody drag does. Air resistance is equal to 0.5 times speed squared times area times Cd (drag coefficient). The equation that PhysX reportedly uses for drag calculation is exactly that - it is just that it does not take area into consideration (I am going to assume 1m2). Since frontal area does not change and car going sideways is not a case I would calculate for you could take a counstant you like and multiply it by estimated frontal area of the car OR if you need it to be done automatically multiplying the area of each triangle with 0 to 1 clamped dot product of forward direction and average mesh normal of each triangle will do the trick. Manual estimation should do just fine in 99 percent of the cases.
I tried again the Mac Demo on Mac OS X Mojave. Keyboard didn't work.
I tried again the Windows Demo on Windows 7 64bit on a Surface Pro . Keyboard didn't work.
I tried again the android demo on a Google Pixel xl. It works but all texts and buttons were extremely tiny.
Is it just me or? It's a pity that the demos were not working.
That is quite interesting. I tried the Windows demo a few days back and it worked fine, will check again.
Hi, I rather have a working android demo app. can you please fix it. Also, after playing for only 1 minute, my phone became extremely hot.
I have not frame capped it so it is using all the resources it can. Of course it will get warm. How much depends on the phone model and manufacturer.
how to save DashGuiController script ?
odometer values etc
DashGuiController is just a script that controls the GUI. It pulls values from different scripts.
Might I ask why you are saving the values? I am guessing you have some kind of save game implemented?
Will need a bit more detail for an accurate answer.
Any ideas on how to compute car G Forces ? I'd like to monitor acceleration/brake and steering G forces, for making a 2d graph.
Tried this float Gforce=( currentVelocity- lastFrameVelocity ) / ( Time.deltaTime * Physics.gravity.magnitude ); as per this thread https://answers.unity.com/questions/479423/how-do-i-calculate-g-force.html but it doesn't really work in all scenarios.
This should be quite easy as the gforce is in essence acceleration indicated in "gravity units". So acceleration of one gravity.magnitude would be 1G.
Vector3 gforce = vehicleController.Acceleration / Physics.gravity.magnitude;
will give you a gforce vector. You can then do whatever you want with it - get the magnitude or even use Vector3.Project to get individual components.
If you want to display the g-force indicator like some action cameras have you can use Vector3.ProjectOnPlane(gforce, vehicleController.transform.up) and use x and z coordinates to set the indicator position.
Awesome, tested and works fine, many thanks
Hi All! Can anyone recommend settings for a 1960's muscle car? In particular I am looking for that "floaty" suspension feel when cornering hard.
Perhaps related to this - is there anywhere we can find/share these settings? I love driving but I really don't know what half of the settings do.
You can get the behavior you want with:
- long suspension travel / spring length
- relatively low damping (both rebound and bump)
- relatively high vehicle mass (2-3 tons)
- weak spring force
This is about it. If it helps the values are called the same way so you can do a quick Wikipedia lookup if you are interested in what variable does what.
Also, if you can find real world values for a specific car it is always the best way to do it. For example the classical American police car is Crown Victoria (Crown Vic for short) and there is a lot of info for it. E.g.:
It states that the spring force is around 100 N/mm. With suspension travel of 0.35m (350mm) that would result in maximum spring force of 35,000N (I made this field be maximum spring force instead of force/unit to be easier to eyeball spring strength in relation to weight). That makes it be able to support 3.5 tonnes in standard gravity on its own.
Weight of Crown Victoria is 1850kg.
Damping rates are hard to find and it is best to eyeball them.
As for the gearing and such things any detailed car specification site will do (e.g. http://www.new-cars.com/2003/ford/ford-crown-victoria-specs.html)
You can also pull the horsepower from there and search "Crown Victoria dyno" for power curve.
Hopefully you get the idea
Excellent! Many thanks.
Has anyone managed to set up force feedback with this? I am using a Thrustmaster TX steering wheel and FF would be a great addition to the experience. Any pointers would be greatly appreciated. Cheers.
Force feedback is not supported but is a good idea.
The best way to do it would be to feed into the wheel controller's slip value and make a separate animation curve where X denotes slip and Y denotes force feedback. While reading the research material for WC3D this was the most common way to do it.
So something along the lines:
float forceFeedback = (forceFeedbackCurve.Evaluate(leftWheel.wheelController.sideSlip) + forceFeedbackCurve.Evaluate(rightWheel.wheelController.sideSlip)) / 2f;
This is just pseudo code and it does not take any gemetry changes that might occur with spring travel. Also, you might want to increase the feedback as the speed goes up.
Added this to TODO list's ideas as I would like to implement it as soon as I find some free time.
I am trying desperately to get realistic vehicle physics for a jeep, which is short wheel base and bouncing all over the place on my offload terrain. Also having a tough time with the steering as it's way too sensitive. Can I send you my invoice for NWH Vehicle Physics and get your jeep demo from the WC3D asset? I think this might help me to better setup my offload vehicle with "upgrades".
Thanks, loving this asset. Will send you a PM with my invoice.
So somebody tell me NWH uses Photon multiplayer or not? If I buy this packae there will be scene with Photon? It yes, there will be a diffucult to use it for no-coding user of unity?