Overlap event only works for some parts of collision box
I am working on a RTS building system where a preview building is shown during placement.
If the preview building is overlapping other buildings, the build process shall be blocked until the preview mesh of the new building is on open land again.
I need complex collision for nav generation and therefore (as far as I read and tested) cannot use overlaps of simple collisions for the meshes (which would work). Therefore, I created a basic collision box along the bounds of my mesh to check collision with existing buildings. All existing buildings keep this collision box after the build process.
Those boxes do not generate overlap events directly on first contact. I am pretty sure by now that the overlap event is triggered if the middle of one of two parallel sides of the box (in my case the shorter ones) are moving inside of the other box. I wonder especially why only two sides are affected by this. Does anyone know if there is a specific reason for that? The used function for collision check is "GetOverlappingActors". I also tried "GetOverlappingComponents" and tested the functions for my preview actor and for the collision box component in my preview actor.
I already checked the collision settings and everything is overlapping each other correctly. Since the event is also generated (just not early enough), I don't see the issue here. Attached are some pictures to show different situations.
If there is any (other?) way to check for collision in this case, I would appreciate some hints from you since I am still learning :)
Fixed it as follows: In the component hierarchy, I had always tried to put the static mesh or the collision box as root. Then, I tried to put both on the same hierarchy level below a Scene component (see image). With this structure, collision is now calculated correctly.
answered May 19 '19 at 04:17 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here