Collision for skeletal meshes in Wheeled Vehicle

I don’t know is this a bug or feature. But I’ll try to explain my problem.

I have a wheeled vehicle blueprint with a skeletal mesh as a root mesh. I also have a lot of modules for vehicle, which are also skeletal meshes. I use them inside a blueprint. Every skeletal mesh has their own physics body.

The main problem is that when I set up collision for those skeletal meshes, my vehicle in game immediately throws up to the air. If I set to ignore vehicles in collision settings, then vehicle rides normally, but there is no collision with other objects in the level for skeletal meshes(except root mesh), even if I set up block on everything(except vehicle) in collision tab.

When I use static meshes inside wheeled vehicle blueprint, collision works well. I don’t know how to fix such behaviour with skeletal meshes. Of course I can set to ignore collisions for all skeletal meshes inside blueprint and extend root mesh collision bounds, but this is not a good solution for me, because I want to save modularity.

I tried it now and it does not work. I see that collision is start working with objects in the level only when I enable physics simulation for children skeletal meshes. But if I’ll do this, then this mesh won’t be attached to the vehicle and when I will start driving, it will fall to the ground.

Hi Kelheor,

Have you tried creating custom Object Channels so that you can pick and choose how certain vehicle parts interact with each other? See Project Settings>Collision

It’ll add any custom channel to the Object Type and Collision Responses list.

Are you using Simulate Physics on your attachments or “Set all Bodies Below Simulate Physics”? You’ll need to leave at least one bone at the base of any attached mesh as “Not Simulating” for them to stay attached to the vehicle.

If you’d like, you can send me an example project with your issue and I can take a look. You can PM me a download link on the forums if you’d prefer it to be private.

Here’s the example project: https://drive.google.com/open?id=0ByoK5MALiewJSTdRS0Q4LWdiNVU
How to test:
Run project as is and try to drive through the box. You will see that gun(which is skeletal mesh) will go through it. The collision was set to block all, except vehicle.
Then try to change collision for the gun to block vehicle and you will see what’s happened.
Then try to enable physics for the gun and look for the result.

Hey Keheor,

Just a heads up that I’ve reached out to some of our Engineers to see if they have any input on this issue. Thanks for your patience.

I’d like to note that we are still looking into this. The Engineer I was attempting to contact with is unexpectedly OOO lately. I’ve reached out to a different group to try and get this resolved. Thank you for your patience.

No solution yet? I can’t make some vehicle parts(like mine roller or grinder) without collision, which is sad…

Kelheor,

I have been able to get around this issue by using collision primitives instead.
In the project you provided, I added a box collision that is effectively equivalent to the guns bounds, and it properly clips and stops the vehicle.

I have not determined exactly what’s causing your issue yet, but I will continue to look over the coming days.

Thanks,
Jon N.

I tried to add box collision and set collision to BlockAll(or BlockAllDynamics). This workaround does not work if such primitive overlaps vehicle physics body! Vehicle just jumps into the air. Even if it does not overlap, it could cause serious bugs in physics for big vehicles. Try to set scale to 2.0 for the root vehicle mesh(also don’t forget to change size of wheels in wheels blueprints) and see what’s will happen(depends on a position of collision box, it could jump to the air or bend forward or backward). I have such a big vehicle, so your solution is not works for me. :frowning:

Given the above, I do not think that’s a good idea to mark this question as a resolved.

Kelheor,

Sorry, I didn’t try to mark this as resolved it just automatically happens.
The comment chain was just getting a little bulky to follow on the original post, so I thought for readability I’d switch it over.

Also, I’ve seen a few issues lately that cause vehicles to “jump”. Most have been caused by the way the vehicle suspension channel is handled. Currently, the engine hard codes suspension ray casts to use the Vehicle Channel.

You can take a look at this document for more info:
http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/Vehicles.html

My guess as to what’s happening is that your max compression is set so that the ray cast is happening up higher than you intend. Then, when a skeletal mesh is added as a VehicleComponent, the ray cast is clipping this and assumes the suspension is at max compression. To resolve this, it applies force to the vehicle, causing the “jump”. This is also why changing the collision channel for the components may resolve the jumping issue.

Thanks,
Jon N.

Thanks for the explanation.
I did it before and I did it again. I added custom object channel. I added custom collision preset, which ignores vehicle preset and set vehicle preset to ignore this new collision preset. Then I tried to repeat all test cases, which described above, again(with skeletal object and box and with scaled car). There are absolutely no differences in results. Maybe I’m doing something wrong. But if so, can you make a working demo to show me correct setup?

Kelheor,

The key was to have the Navigation Area Class for the box collision set to None, then collisions would properly work. Here are some images / gifs of my setup.

104199-giphy.gif

There definitely seems to be some other issues here, so I’ll keep looking into what those could be and why this option seems to avoid the issue.

Thanks,
Jon N.

I made a lot of tests and can say that Navigation Area Class didn’t affects on this problem. Main factor is box size/position. Try to move it in different positions in blueprint. Looks like it’s a lucky coincidence, that everything works fine, because your box is on top of the mesh and pretty narrow. If box is on front/back of the vehilce and have width of the root mesh(it works like a collision for bumper module for example), then it will bend forward or backward(like on pictures, which I posted previously).

I read this document: Vehicles — NVIDIA PhysX SDK 3.4.0 Documentation

And I think that solution might be in creating custom blueprint node, which adds meshes to vehicle body, so they will be ignored by raycasts.

I found this code in this document:

PxFilterData chassisQryFilterData;
setupNonDrivableSurface(chassisQryFilterData);

//Add the chassis shapes to the actor.
    for(PxU32 i = 0; i < numChassisMeshes; i++)
    {
        PxShape* chassisShape=vehActor->createShape
            (PxConvexMeshGeometry(chassisConvexMeshes[i]),*chassisMaterials[i]);
        chassisShape->setQueryFilterData(chassisQryFilterData);
        chassisShape->setSimulationFilterData(chassisSimFilterData);
        chassisShape->setLocalPose(PxTransform(PxIdentity));
    }

Maybe there is a way to add additional chassisConvexMeshes inside vehActor?

Interesting observation:

If on begin play you will disable physics for root mesh, make a short delay(0.2 sec) and then enable it, then skeletal mesh(like a Gatling gun) with enabled collision(even with vehicle blocking, but in this case vehicle could impact unpredictably with something like invisible walls and I don’t know why) won’t throw a vehicle to the air. It will even be able to collide with other vehicles and objects with simulation physics enabled. It still can’t collide with objects without physics simulation.

Kelheor,

So the issue actually isn’t directly related to vehicles, but with welding in general.

The reason your having issues placing the box in different spots is that the mass of the collision volume (even though it’s not simulated) is still being added into the vehicle, and offsetting the center of gravity calculations. Therefore, placing the cube over just the front or the back will cause extra forces on suspension.

Unfortunately, this is a known limitation of the engine right now. I’ve entered a ticket for this.

Thanks,
Jon N.

I don’t think that problem with the cube is the only one problem to fix. As I said in the last message, we also have these problems:

1.) Skeletal meshes collision in vehicles for non-simulated objects are not working.

2.) Skeletal meshes collision in vehicles can work for simulated objects if you disable and enable physics at begin play. Otherwise, vehicle will be thrown into the air. Still, don’t know why it works, but it leads to the other problem.

3.) If in such case skeletal mesh has enabled collision with vehicles, then sometimes vehicle can impact with “invisible walls”, which is unacceptable. I don’t know why it happens(I can make a video with a problem), but it makes unusable such meshes if you have enemy vehicles.

Can you also give me a ticket numbers, so I can be able to track the progress of fixing this bugs?

Here’s the video: https://drive.google.com/open?id=0ByoK5MALiewJZEo0YjR0VVFtYlU

In first part of the video you can see a bug with “invisible walls”. I enabled vehicle block collision for mine trawl. Without blocking vehicle all works fine(except collision with non-simulated objects), but mine trawl can’t collide with enemy vehicles in that case.

In second part of the video you can see another bug, which I found today. When you drive with reverse gear on, vehicle speed can be increased to the infinity. I don’t know why it happens yet, but looks like limitations on speed is not working in that case.