Foliage collision not working

Hello,

so after trying for a couple of days to debug this myself I have come to the conclusion that I could use some insight from the Epic Devs.

I have followed all the tutorials/documentation to setup the correct collision for my foliage (I tried also with just a simple box with a box collision for debugging sake).
I enabled the BlockAll collision on my foliageType. and then paint 1 instance onto an empty world with just a platform static mesh and a player start. (again this is to make it easier to debug the physics).

So what i found is that my BodyInstance is aparently being added to the physics scene from here

if (Instance->RigidActorSync)
{
	PhysScene->DeferAddActor(Instance, Instance->RigidActorSync, PST_Sync);
}

in CreateShapesAndActors_PhysX

and then marked as added to the scene here
void FPhysScene::FDeferredSceneData::FlushDeferredActors()

but when i start playing my character passes through the geometry if its placed with the foliage tool.
Again I verified in code that the body instance of the UHierarchicalInstancedStaticMeshComponent effectivly is set to BlockAll and it is.

Also it should be noted that if I create a new project and do exactly the same it all works fine.

My game project is fairly large and is setup to use world composition with world origin rebiase disabled.
The asset itself has the flag “Ignore world origin shifting = false”.
I assume therefore that something with the world composition is screwing with my foliage collision. I can’t really see what that could be though so my hope is that some of you guys could point me at some possible good debug breakpoint locations to further dig into this issue.

thanks

actually i realise that if i create that empty level, there is no world composition enabled. So it probably must be something else causing it. Maybe some collision settings on my character or the world ? The project is really old and has just been upgraded from version to version (currently 4.8.1)

hm I just found that it has most likely something to do with my character class.
If I try use the first person character Blueprint class everything works fine.

Hi ,

  • Does this occur in a clean, blank project with no additional content or is it limited to this specific project?
  • What are the collision settings you are currently using on the foliage and on the character?
  • What is the expected behavior and what behavior are you seeing instead?
  • Do you have any steps that I can take to reproduce this on my end?
  • If no to the above, do you have an asset I can test with?

Hi ,
it is limited to this specific project, and in particular I believe to my custom character or how I spawn it via code. (as stated below I found out that if I use the standard FirstPersonTemplate character BP it works fine).

My custom character class has a capsulcomponent as its root with “pawn” collision setting on it.
The box which i spawn via foliage tool is set as “BlockAll” and is static geometry.

The expected behavior would be that my character cannot walk through a foliage tool placed box. Instead he walks through the box even though the box is set as blockall and has collision geometry. In fact if i place the box in my level manually, my character cannot walk through it.

Unfortunately my code/project is pretty custom in some parts so not easy to share.

What I am looking for is to understand if there is any difference in how the characters handle collision with foliage as opposed to normal meshes. Because normal meshes work fine its just the foliage that for some reason doesnt collide with my character or viceversa.

here i have two screens of the body instance of my character capsule and the foliage hierarchicalinstancedstaticmesh

EDIT : sorry fixed first immage

alright so I am almost sure it has to do with how i spawn my player character (and probably characters in general). I tried spawning my character the “normal” way and it all works fine. It is still strange that only collision with foliage isnt working though. I can colide fine with anything else in the world.

I can post my spawn code if that would help but i feel like i am missing something really simple that i am not enabling when spawning my character.

So the question goes back to " What is the difference between foliage static mesh collision VS placed static meshes".

so i nailed it down even further.

I am calling

    FIntVector NewOrigin = FIntVector(SpawnLocation.X, SpawnLocation.Y, SpawnLocation.Z);
    World->RequestNewWorldOrigin(NewOrigin);

since i am managing myself where and when i want to spawn for various reason. Calling this method and the way i managed it so far never caused any issues but for foliage it seems to be different.

any idea what might be wrong ?

i also found this thread which hinted at something similar
Thread on AnswerHub

but the solution he proposes isn’t very clear to me.
But it sounds suspicious.

So trying to put “Ignore world shifting” onto the Foliage Actor makes hierarchicalinstancedstaticmesh component not move (ofc since its owning actor ignores origin shifting) and since in my test case I made the shift small enough for the box to be still on my platform, the box actually now collides with my player character. So this leads me to the conclusion that somehow the physics shape of the instanced static mesh is not being moved when the origin shifts or it is being moved somewhere else. I attach some screeenshots that illustrate what is happening.

and one more test, moving all actors to the origin, then do “play from here” slightly offset. I have now a collision with the same offset next to the visual of the box (see screenshot). Its almost as if the offset is being applied twice.

here an even better screen that illustrates the issue.

Hi ,

If you are comfortable with it, can you post a sample project showing this error so I can reproduce it with the specific setup you are currently using?

i just got a really really easy repro on an official 4.8.1 build pure blueprint.
And it also seems that on official 4.9.2 the issue appears to be fixed at least if i try the same in BP. I’ll post a screenshot of my level BP in a minute…

here the repro, just create a simple 3rd person BP project in 4.8.1 (official build). then follow the steps in the 2 screenshots.

since it appeas fixed in 4.9.2 i guess if you could tell me what the change was i could locally fix it without getting all of 4.92. I didnt want to upgrade my code until 4.10 officially lands.

Unfortunately it looks like this may have been fixed by proxy as opposed to receiving a direct fix. As such, I do not have a specific github pull that I can give you to address this error immediately.