Invalid ConvexElem

Hello,

In Unreal 4.16 I was getting the following warnings (tank_fbx_Turret is a static mesh):

LogPhysics: Warning: PopulatePhysXGeometryAndTransform(Convex): ConvexElem invalid
LogPhysics: Warning: ForeachShape(Convex): [/Game/Tank/tank_fbx_Turret.tank_fbx_Turret] ScaledElem[0] invalid

After upgrading to 4.17 the engine throws an error just before begin to throw again the previous (ConvexElem invalid) warnings. The top of the error message is:

LogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: OutTM.isValid() [File:D:\Build\++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\Engine\Private\PhysicsEngine\BodySetup.cpp] [Line: 845]

The lines from 845 and onwards in BodySetup.cpp are:

		if (ensure(OutTM.isValid())) {
			return true;
		} else {
			UE_LOG(LogPhysics, Warning, TEXT("PopulatePhysXGeometryAndTransform(Convex): ConvexElem invalid"));
		}

OutTM is a PxTransform reference.

Just for a bit of context. In the game I have a tank composed of several static meshes, and the problem arises from the only two meshes which I created in C++ (inherited from UStaticMeshComponent). I created these classes because I needed to save some info related to those specific meshes (the turret and the barrel).

At the beginning I thought it had something to do with (not properly setup) collisions among the meshes (because these two specific meshes rotate). But I assembled a weird looking tank putting the meshes FAAR away so no matter what the movement it would be imposible for them to collide, and still the aforementioned warnings happen.

Soooo… I don’t know if there is a bug when using “C++ made” static meshes, or if it was a mistake on my part. Maybe someone has an idea what could it be. Or how am I supposed to trace engine code (in case there are such guidelines) because I wanted to add some flags to BodySetup.cpp where the error happens but it is a read-only file. I could manually change that property in the file but I don’t want to mess the engine code up by doing things the wrong way.

Just in case you want to take a look to the actual project you can check it out from GitHub: GitHub - Unreal-Course-1/04_BattleTank: An open-world head-to-head tank fight with simple AI, terrain, and advanced control system in Unreal 4

In the Content Browser you will find the static meshes in question in the Content/Tank/ directory. And the C++ Static Mesh Components (TankBarrel, TankTurret) in the C++ Classes directory.

With the project as it is, just playing and moving the turret around (just moving the mouse) will show the Invalid ConvexElem warnings (within 1 min).

Well, sorry for the lengthy post, and thank in advance for any light you could shed.

Thats your Collisions that are messed up. Fix them up here you can find some info (with a example what is Convex and what not):

Ok. Thanks for the info, I’ll take a look.

Hi, I’m also having that UE4 course. These warnings(also errors, but only few times) also troubled me a lot. As Nachtmahr mentioned, it has something to do with collision. What I did was Collision → Remove Collision to both tank_fbx_Barrel and tank_fbx_Turret and warnings(errors) disappeared. Also, I later Add Boxed Simplified Collision to both of them, and it seems boxed collision works just fine.

Don’t know the exactly reason also. Hope it can help u. :wink:

Here’s a solution which worked for me:

hope it helps…

Yeah I’m following the same course and got stuck at some point where I’m getting these error
I removed all the colliders from the meshes that I used and added simplified box colliders for the tank_body and the tank_track
followed his tips
Thanks
if you got stuck follow these it will help