Hi HunterPT,
since some of the points you’ve mentioned are based on my code snippets, I’ll try to explain the reasoning behind them. Do note that I haven’t fully read all the code of this plugin so can’t comment other parts of the correctness of it.
That’s something I put into my initial substepping example here: The Re-Inventing the Wheel Thread - Community & Industry Discussion - Epic Developer Community Forums
To be honest. I’m not quite sure why I put it there. Basically only thing it does on it’s original form is that it prevents damper to counteract when you return to ground at that specific moment but that’s about it. I’m sure there was some logic behind it but I really can’t remember it anymore. Anyway, removing it should be just fine.
I suggested TegLeg to try that dotproduct there. You are right about it not being fully correct but just using UpVector * SpringForce isn’t either. What I suggested there is a compromize that works most of the time well and I didn’t find any bad side-effects for it.
I’m explain this bit further:
For example, if you just do BodyUpVector * SpringForce and have your vehicle aligned so that front of the body is lower/higher than it’s rear., then that force will actually push the vehicle slightly forward/backward as well, also sideways if body is leaning left or right. On inclined surfaces, this is correct, but if your wheels are on even surfaces (think about stairs or any steps for example where the tires itself are on flat even surface) your vehicle should stay still and not move at all.
If you calculate suspension force by multiplying it by linetrace’s hit.normal like I did on my original code snippet (which wasn’t meant to be used as vehicle suspension as is), then it would work on that stair example right, but it would mean spring actually acts in all directions instead of just up.
So the compromize I suggested was to use that but for only the part of the force that can act in vehicles up direction (assumption that springs move directly up and down in this case), it’s kind of combination for those both but in extreme angles it just gives you too low values. Again this isn’t fully correct way to do it, but if you want to do it right, you have to take a lot more forces into account for the wheels themselves.
I’ve made that same point earlier on this thread too. There is force involved as AntirollCoeff though (its 5000 N/m on that Unity example). In vehicle dynamics literature, antiroll bar is sometimes approximated in form of ForceARB = AntiRollCoeff * (SuspensionPos1 - SuspensionPos2) which is essentially what you are doing there. You may normalize the values to tracelength like you do there, but you’d just need to use bigger Coeff force then. By the way, there are ways to calculate that force coeff from ARB dimensions as well but in the end, since this is still a very rough estimate, you’d just find a good value that keeps your vehicle from tipping over too easily.
If you want to share your version of the fixed code, it would probably help others the most As a side note, I think that if people want to build a community based vehicle model, it should probably be in github etc place where it would be easier to manage and get people’s pull requests and forks handled better.
That being said, you may also want to check BoredEngineers MMT-plugin ( [OPEN-SOURCE] Machinery Modelling Toolkit - World Creation - Epic Developer Community Forums ) as he’s done lots of vehicle related things there as well. MMT is still missing 4-wheeled vehicle example but I think if people concentrated on one community based open source solution, it would benefit all. Most of the actual content there is implemented in BPs but it shouldn’t be that hard to convert those into c++ or eventually build both c++ and BP examples for different types of vehicles.
If you have any further questions / thoughts about vehicle physics, feel free to ask here or come join us at UnrealSlackers or #unrealengine IRC-channel @freenode.