The Re-Inventing the Wheel Thread

Sorry no, didn’t update to 4.21 yet.

Well have you had any luck exposing the variables and functions from default ue vehicle? i cant even get that working. I mean can you help me out with that? You definitely seem to know more c++ than i do.

the default ue vehicle is plagued with problems, hence the various alternatives available on this forum. the problems with that vehicle are in the physx implementation itself so even exposing variables and functions does not offer any solutions.

im toying with the idea of using ue4 for my next project so i might eventually update this plugin but dont pin your hopes on it. maybe vr_marco will do it at some point.

in the meantime boredengineer made something you might find interesting, i think its blueprint based, here [OPEN-SOURCE] Machinery Modelling Toolkit - Community Content, Tools and Tutorials - Unreal Engine Forums

Well the default ue vehicles ive managed to overcome the issues everyone was having, in fact it looks like it was never an issue, it was all about settings and very poorly explained comments. I get zero cars flying into the air, The suspension is totally smooth just like seen in this plugin and BlueMans and if i crash into another car im able to move it where many said it would stop car dead in its tracks. And all this with no modification to code simply thoroughly checking and tweaking settings. I will post a video on this soon, but i really would like to expose some variables. So if you could help me with that i would really appreciate it. im using Ue 4.21 Vs 2015

All the code examples ive found on the net none seem to translate to ue 4.21, so i take it something changed in ue’s code.
Can you are someone help on what is it i need to expose Lat Slip, Change wheels at run-time etc., I would really, really appreciate it.

sure
you have to build the engine from source, then you can expose anything you want. looks like ue has changed significantly since i did it so you might have to make get/set functions for variables.
if you dig deep enough there is even toe in/out and other such things. its a full on vehicle sim underneath

actually i think vehicles were moved to a plugin a while back so you might just need to build that and not the full engine, i dont know
best of luck

Oh wait! so the launcher versions arent good for exposing c++ variables? i thought you could use launcher versions for that as well.

well yes you need to change the engine (or plugin) code
a private variable will stay private unless you change it in the source

from what i remember a lot of the more interesting things were buried in the physx files and were ‘glossed over’ by the ue vehicle implementation
i havnt even looked at ue4 really since around 4.08 so it might have changed

Hi tegleg anything on a ue4.22 update of your plugin? I mean your plugin to me seems to be the coolest one ive seen to date. i figure i ask one last time.before totally giving up. Oh and by the way the boreengine link i tried it but it’s too bloated and taxing if you want to add more than 5, not to mention it crashes just looking at it.

Can anybody provide the blueprint version

@porkchop

hi
just spent ages trying to get this working on 4.22 and have 2 last errors i have no idea how to fix.


Severity    Code    Description    Project    File    Line    Suppression State
Error (active)    E0020    identifier "FMeshDrawSingleShaderBindings" is undefined    CarPluginProject    C:\Program Files\Epic Games\UE_4.22\Engine\Source\Runtime\RenderCore\Public\VertexFactory.h    626  

Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK2001    unresolved external symbol IMPLEMENT_MODULE_TestCar    CarPluginProject    J:\UE4Projects\CarPluginProject 4.22\Intermediate\ProjectFiles\LINK    1 

if anyone can shed any light it would be most appreciated. seems a lot has changed with plugins since 4.19

here is a zip of just the plugins folder with the code files
https://www.dropbox.com/s/vmdj8ctpi8…ugins.zip?dl=0

@EU4VR there is no blueprint version

thanks

Ok fixed it. here is the latest version

Updated to 4.22.3 / VS2017

Download link Dropbox - File Deleted

Hi Tegleg, i just tried it out but after about 20 or so seconds of driving the vehicle it just disappears, as if it where either destroyed or garbage collected. any ideas?

If this only happens randomly when you drive around, it’s probably same weird thing @Hevedy had on years ago on this same project. I could reproduce it on my end with his port but when I used version I ported myself it worked just fine. We never really discovered what was wrong on his version as code was somewhat the same, I always suspected some asset corruption on UE4’s end.

i too got that bug, im guessing it is a corrupt asset.
i replaced the car body mesh with another one and it seems to work fine now. (its an intentionally bad mesh so you use your own)
also fixed it so where you place the arrows in the blueprint is where the wheels will be, must be something i forgot to sort out way back

here it is

The normal’s on the 1959 Chevy Impala are screwed up. How can we fix the problem?

it also has no doors, bonnet or boot. the intention of this plugin is to provide the code so you can make your own cars.

1.either make or download your own car model (impala was from google warehouse originally)
2. the car body needs to be a skeletal mesh with 1 single bone which will be the center of gravity.
3. the wheels are a single static mesh
4. either duplicate or modify TegCar 8 blueprint with your own car model
5. adjust spring, engine etc settings to suit
6. make an ace game

If you want to fix they normals you just have to use a two sided material.

If you want to fix the cars flying into the air or disapearing it’s a simple fix.
You have to change the following lines

FVector AntiRollForceF = FVector();
and
FVector AntiRollForceB = FVector();

to

FVector AntiRollForceF = FVector(0);
and
FVector AntiRollForceB = FVector(0);

The current code creates an uninitialized vector and appends to it. :wink:

Also line
float GripMultiplier = FMath::Max(TraceLength/SpringLengthArray[Index], MaxGrip);

Should be

float GripMultiplier = FMath::Min(TraceLength/SpringLengthArray[Index], MaxGrip);

Also the Long slip and slip thresholds are summed when they should be clipped as an ellipse
The code below would need the tire smoke fixed too, but if you change

TireForces *= GripMultiplier;
to



float ForwardComponent = FVector::DotProduct(TireForces.GetSafeNormal(),WheelForward) * LongSlipThreshold;
float RightComponent = FVector::DotProduct(TireForces.GetSafeNormal(), WheelRight) * SlipThreshold;
float MaxLength = FMath::Sqrt(ForwardComponent * ForwardComponent + RightComponent * RightComponent);
TireForces = TireForces.GetClampedToSize(0.0f, MaxLength);

TireForces *= GripMultiplier;

It should produce more accurate results.

Hey OuttaSpace how would you change the trace to sphere trace instead of line trace and also get surface hits. Can you help on this?

You’d have to look into the
FHitResult Trace(FVector TraceStart, FVector TraceDirection); function
it does the trace on the
GetWorld()->LineTraceSingleByObjectType(Hit, TraceStart, TraceEnd, ObjectParams, TraceParams);
line

Just look into the documentation and change that line to a sphere trace based on your parameters.