[4.7.3] [Physics Sub-stepping] Procedural collision doesn't update when you drag actors around in editor

I’m going to use the Procedural Mesh Generation example on the wiki as the jumping point for this bug. It’s clean and easy to repro the issue with. The GitHub project can be found Here.

  1. Enable physics sub-stepping in Project Settings
  2. Restart the editor (This is probably a bug on it’s own, but you seem to have to restart the editor to get sub-stepping to work correctly)
  3. Place a ProceduralCubeActor
  4. Open the Collision Analyzer and take a few samples of the cube you’ve placed down. Everything should behave as expected and you should get a bunch of nice ray hits on the box.
  5. Drag the cube 1 or 2 cube widths away from it’s starting location.
  6. Use the collision analyzer to take a few more samples where the cube is now and where the cube was before.
  7. You’ll notice that when you look at your ray samples, the cube’s collision shape will still be at it’s initial location and not in the new place you moved it too

This doesn’t seem like it should be an issue with the exmaple, it works correctly with sub-stepping disabled.

Note: In order to disable sub-stepping to test that, you’ll need to restart the editor again.

Hey kylawl-

I’m not sure I understand what you’re referring to. Would it be possible to get a screenshot or short video of the collision analyzer and what you’re seeing to help explain what the problem is?

Cheers

Doug Wilson

So this is what you’d expect, a bunch of hits that make impact with the cube correctly.

Then I dragged the cube 200 units on x and clicked a bunch more times. Notice no successful hits on the cube but the old location still successfully reports a hits floating in mid air.

I’ve also submitted a related issue as a separate bug here https://answers.unrealengine.com/questions/207100/473-actoractorlinetracesingle-doesnt-work-correctl.html There is some overlap between these 2 problems it seems.

Hey kylawl-

Thank you for the screenshots. I was able to reproduce the ray casts not showing hits on the object after being moved. This has been bugged in our internal tracking system (UE-13362) for further investigation.

Cheers

Doug Wilson

Hi kylawl,

I’ve downloaded the project and noticed a few things.
First I was getting a crash inside the raycast code. The reason is that the number of materials returned in UProceduralMeshComponent::GetNumMaterials is 1, but then later in UProceduralMeshComponent::GetPhysicsTriMeshData we are setting the material indices to be 0,1,…11 which would indicate we have many materials.

The line CollisionData->MaterialIndices.Add(i); should be changed to CollisionData->MaterialIndices.Add(0);
I would add this to the wiki, but I figured it’d be easier to mention to you since we’d want to update the github project as well.

Anyway after I fixed this first issue I was able to move the cube and the raycasts worked correctly.

What happens when you use the command pxvis collision? When I use it I see the procedural cube in the right location.

Hi Ori,

I was using the UProceduralMeshComponent as the test case since it is what we had used for our reference to get our voxel system running.

As I was writing this but report and the other one about ActorLineTraceSingle were were actually in the process of adding some new material features to our plugin. So I went back and tested this now after your response, and YES it does seem to work correctly now that we’re reporting the correct number of materials and emitting the correct number of materials in GetPhysicsTriMeshData().

I can also confirm that it appears to have resolved this issue as well https://answers.unrealengine.com/questions/207100/473-actoractorlinetracesingle-doesnt-work-correctl.html

Pretty weird result from this cause.

Thanks Ori.