I’m running into either a bug or engine limitation when it comes to actors with projectile components. I currently have a projectile actor which is a sphere collision with a projectile component attached and another sphere collision attached.
Everything works fine with only one collision, but when I have two and call an on hit or on overlap event with the second collision it seems to make an empty hit result for location. The event still fires but there is no hit location in the result struct information being returned.
Has anyone else run into this?
If this is an engine limitation, has anyone figured out a solution to having two colliders on a projectile?
Movement components only sweep the single collision component they are tied to. Any attached components will teleport to the end location of the sweep. It is possible to override MoveUpdatedComponentImpl() to extend this behavior, if you desired to to a test sweep with both and only move the distance of the closest hit.
I’m still not clear on which hit event you are receiving with incorrect location. What do you mean by “empty hit result for location”?
Thanks for the reply, I thought that would be the case.
My blueprint was set up as:
Sphere collision 01 (WorldCollision) was set up to generate hit event on static mesh
Sphere collision 02 (CharacterCollision) was set up to generate overlap event on pawn
Sphere 01 OnHit events would fire fine without any issues.
Sphere 02 OnOverlap event would fire when overlapping pawn, but would return 0,0,0 for sweep locations.
The aim of the blueprint was to have a large collier for colliding with pawns than the projectile has to collide with static meshes.
The thing that confuses me is this set up would work sometimes, mainly while “playing in editor” but as soon as you try it in a new window or as a packaged build it does not work.
I suspect this difference you’re seeing is due to framerate differences between PIE in editor versus new window or packaged builds.
Attached components do not sweep, so you will get the overlaps only at each frame’s new location (nothing in between).
I suggest implementing custom movement if you need this behavior.