I switched a few of my meshes to UE4 cubes and the collision stopped working. I made several changes during this process. So I wasn’t able to identify the root cause. I decided to create an empty project for debugging. I have a timeline which sets the object location. I have tried the following.
1.) Blueprints directly in the map
2.) Static meshes moving within a blueprint
3.) Child actor components moving within a parent blueprint
- Everything is set to blockAllDynamic.
- The default root scene has physics (“should update physics volume”) checked
- I tried calling SetRelativeLocation with and without sweep enabled
- I verified that the collision volume is correct
Is this an issue with driving an actor/mesh with SetRelativeLocation? I expect it is a simple setting, but I haven’t found it after rooting around. I found this related question but there was no answer.
[Collision is not working between static meshes when using set actor location]
I have attached the entire basic debugging project (2.5 MB).[Collision Debuging Project UE4.9]
Please note that the extra timeline in bpPlayer was for testing the blueprint directly within the map instead of as a child.
I forgot to mention that I enabled physics on the top cube and removed the SetRelativeLocation timeline. The top cube drops and correctly collides with the bottom cubes. However, it doesn’t work with either set location or transform. I also tried explicitly enabling collision in the constructor (see below). This didn’t work either.
I found the following post in the forums. Zak Middleton (Unreal Engine Developer) responded as follows to a similar question.
[Proper way to move an Actor / Collision Not Working]
Zak Middleton (Unreal Engine Developer): The issue here is that the CollisionComponent is not the RootComponent. When you use SetActorLocaiton(…), that sweeps the RootComponent, and teleports attached components, so they don’t get hit events (only overlaps). You need to set the collision component as the root instead.
I found this to be an interesting tid bit about the RootComponent. However, it didn’t help me.
I used the blueprint to test collision. I tried various versions of the SetLocation (Actor etc…) and Transforms as well. I tried it with and without sweep enabled.