Chaos vehicle is pushed by Main Character

I’m making a game where you can run as third person character and drive a car. For setting up my truck I’ve decided to use Chaos Vehicle from UE 4.26. I’ve successfully rigged it and it drives well. But I found out a bug, when you run or jump as main character and you accidentally collide into truck, the truck bounces around, so you can push it as it was made out of paper and weighted nothing.

I want my truck to behave more or less like the real truck. I’ve tried to disable Physics for truck while my character is not driving it. It worked, and I was no longer able to bounce it around, but when I tried to drive it, it drove just fine, but for some reason all 6 wheels stayed in without any movement, while the truck, without wheels, was driving around just like before. After I exit the truck, wheels teleport and attach back to the truck.

I guess Chaos Vehicle component does not really like when I turn “Simulate physics” on and off during runtime. I’m pretty sure it has something to do with the process of creation of ChaosVehicle, but I have no idea how to fix that.

If you know how to turn Physics on/off for ChaosVehicle in runtime correctly, or you know other way to stop my car from being pushed by my main chacter, please let me know.

Hey, did you ever find a solution for this problem?

Thanks in advance

Any good tips for this issue ?

Yes.
Make the vehicle not a vehicle until the player interacts with it.

For one, there’s no reason for it to sit there unless something needs to use it as a vehicle, so it should really never just be a vehicle.

For 2, you aren’t going to get the current physics engine - chaos - to behave right no matter how blue in the face you turn, mostly because even thohgh they pushed it to prod it is so raw that if it were a cow it would still moo.
And partially, because the player capsule’s movement component AND/OR the physical animation component are essentially unstoppable forces capable of spinning around earth to reverse time. Yep, is it a bird? Is it a plain? No. Its the unreal character capsule.

With 4.x in a custom build and the latest physX dll (which is not included on stock engine), you can put some time into getting Mass and other aspects to be respected (however note that whatever you do, the physics are still more “bouncy” than reality. Unexplicably so perhaps).

So, to “fix” a player or even a projectile from being able to rock or sway a vehicle, your easiest solution is to not have a vehicle to deal with unless you have to.

Same applies to any physics. And For any engine, really.
Unless something is being interacted with and requires simulation, it shouldn’t even be the type of actor which can simulate.

In the case of “player vs car” your best bet is to just disable the player by proximity in some way.

Doesn’t necessarily mean you need to make it ragdoll when the car is approached, but if you turn off input when the vehicle is touching, and the vehicle is moving, the physics will do some of the rest.
The basis of the problem originates from the movement input force being applied and used to calculate against the vehicle (which for human vs car is essentially an impossibility) so you can eliminate that part alltogether a few frames before impact and save yourself from having issues.
I’d suggest doing this for anything the player approaches.
Meaning theres no reason to move forward against a wall, so why bother applying the input in that direction?
For games that make some use of physics, this can be beneficial. Preventing you from pusing objects around unless they are specifically tagged into a collision channel…

2 Likes

Hey, I think I got it: in the Physics section there is Constraints Category - lock all pos and rot axes at default mode and the vehicle is static. To suspend the locks use “set constraint mode” node applied to vehicle mesh with mode = “none”.

From my experience, this is from the unyielding kinematic body capsules of the character slapping the vehicles when a limb moves around.

In my case, I had vehicles and other large physics objects ignore such collision channels and only use the Pawn capsule to collide.