Download

Physics behavior in runtime not matching the physics asset

Hello everyone, I’m new to the forum and to UE4. I’m not new to 3D edition in Max or C++.

After many days fighting the same problem, I’ve decided to ask for help here.

What I’m trying to do: something starting with the simple vehicle c++ template project.

What I’m facing: I created a very simple model in 3Ds max and imported it to UE4 Editor. When I run the game, it does crazy stuff.
-The wheels seem to spin in all three axis, not only in Y.
-First it was bouncing around without control
-Now it behaves a bit like a vehicle, but it acts like the wheels are all in X=0, in the center of the car longitudinally, so the car leans to the front ot to the back. (See image)

What I’m (I think) doing well:
-I created my model in 3Ds Max. It’s just a box with 4 cylinders as wheels. The frame has the origin in 0, 0, 0. Each wheel has its origin in its geometrical center. The frame is a bit over the ground, with the wheels just tangent to the ground or 1cm above (I tried both)
-The car is facing X positive. All the bodies have X facing onwards and Z facing upwards.
-I’m not using bones. I just have those 5 bodies in Max, with the 4 wheels linked to the frame.
-I made sure that the wheels radius is the one expected for the C++ class.
-I made sure that the wheels body names are the ones expected for the C++ class.
-Im applying a xform modifyer and reseting tranform / scale to all bodies as suggested in this link: https://www.youtube.com/watch?v=2xEu…ature=youtu.be
-I’m importing the FBX as a skeletal mesh. Units are right and consistent (measures and weight)
-In the physics asset, I’m creating a box for the main body and 4 spheres linked to it for the wheels. The wheels are free to spin in all 3 axis, like in the template project (I’m assuming that the wheels class will contrain them)
-When I simulate it in the physics asset editor it behaves correctly,
-I’m not creating a blueprint for the vehicle since I’m assuming that the C++ class does that job.
-I’m not touching anything (still) in the C++ code.

So if you could suggest me something else to try and check, I would be more than glad.

Thanks in advance,

Gustavo.

Update: I’m still stuck, but I observed something even weirder:

I checked my collisions and bones in runtime (see image) and collisions are ok, but the vehicle acts like I had a collision body on (0, 0, 0)

Also, when I throttle or brake the vehicle goes backwards. All this makes me think that the wheels are not being assigned properly to their bones, and they are instead working on 0, 0, 0 and with random alignments. But I don’t know how to check the wheels. Any ideas?

Another update… Using the command pxvis collision 1 i got to see the actual wheel collisions and they are where I supposed (see the image)

Since I think that pivots on my wheels are in the right place, with the right orientations and all, I assume it’s a problem of the vehicle class not finding the right bones to assign the wheels to. But I don’t know how to fix it…

(regarding the command “pxvis collision 1” I just found it here: https://www.reddit.com/r/unrealengine/comments/9cdr8t/a_problem_with_vehicle_wheel_collider/ . The user had the same problem as me but fixed it manually modifying the offsets, not what I need)

Another strange issue… I managed to see my car from the bottom and see how it behaves. All the wheels are around the vehicle origin, but with some offset in Y, and it’s weird because I didn’t give them any offset.

Also, looks like when I turn to each side, only one of the wheels turn.

5.jpg