Hi,
When adding a custom collision mesh to a vehicle wheel, the editor will crash if the vehicle hasn’t enough physical parts.
No log or error message appears, I had to find it by starting Visual Studio and attaching to the editor to find the cause.
Cause
Failed check in the code causing the crash:
…\UnrealEngine\Engine\Source\Runtime\Engine\Private\Vehicles\WheeledVehicleMovementComponent.cpp
Function: SetupWheels
Check failing: check(NumChassisShapes >= 1);
How To Reproduce
I came across this bug because my vehicle has only only had a single box mesh for a body and 4 wheels. But the fastest way to reproduce this is to use the vehicle game and remove some parts from it.
- Create a new VehicleGame project
- Run the game to make sure it works
- Open VH_Buggy_WheelFront in Content/Vehicles/VH_Buggy/Blueprint
- Turn “Dont create shape” checkbox on, ‘Collision Mesh’ should be set to Cylinder
- Compile and run game again and the vehicle should use the new wheel collision mesh
- Open SK_Buggy_Vehicle_PhysicsAsset in Content/Vehicles/VH_Buggy/Mesh
- Delete some of the unnecessary col parts (see screenshot attached)
- Save and run the game again, editor will crash / exit out without any messages or warnings
Let me know if you need any more info.
Cheers,
Dave
Hello daveREspawn,
I’m not sure of your intended result, but when you delete all of these bodies, there are no longer any bodies that are under the root that are not set to Kinematic, meaning nothing under the root is there that could be considered part of the chassis and be used for the physics simulation. You can see an example of this by setting one of the wheels to Default instead of Kinematic. The crash won’t occur in this case.
What are you intending to do that would involve not having any bodies for chassis? It may end up being more useful for you to create your own vehicle system that doesn’t inherit from our system that is based off Phys X in some cases, which is why I’m asking.
Hi Matthew,
Cheers for the reply. My end goal was to add a custom collision mesh to the VehicleWheel when I hit the issue described above. But all attempts to do so failed.
I created a separate thread here about it.
A bit off topic for this thread, but; Do you know if it’s possible to add a custom collision mesh to a wheel, or will it always use a round wheel?
Thanks,
Dave
If you want to make use to the built in vehicle system, you would always need to use a round wheel. Once the VehicleMovementComponent is part of a class, it’ll ask for 4 bones with bodies to be considered as the wheels, as you can see in the VH_Buggy blueprint. When these bones are selected, the wheel collisions are generated based off the VehicleWheel blueprints provided. That’s where the cylinder comes into play. You may be able to get around this by providing a different mesh as the shape, but I’m not sure if the vehicle would actually work.
If you’re looking to do something custom, I would suggest looking into methods such as this one for creating your own pseudo vehicle system.
Thanks Matthew, appreciate it.