I have a projectile that moves at 25000 velocity and I am having a lot of collision issues with it. Sometimes it prints “hit” and sometimes it doesn’t and I can’t find a pattern to it. How would I make it consistently hit?
There is a lot of dodgy stuff going on with your code but to keep things simple I’ll go with it for now:
You realize that you only print ‘hit’ when the length of your array is exactly 1? I don’t know how your level looks, but since you overlap all dynamic actors it seems like you could easily overlap more than 1 depending on where your bullet goes, and if you overlap more than 1 actor the message won’t print. Maybe also connect the > output to the branch, that way you get a message printed when you overlap one or more actors.
However, if you are aware of this and that is not your problem, it is most likely because your bullet is too fast for your framerate.
Yes I realize this but is there a way that I can have fast projectiles even with my fps or should I resort to using linetrace instead for fast projectiles?
The problem is that the box moves a certain distance every frame (Velocity * DeltaTime to be exact) so the overlaps are checked not continously but at discrete locations. This is obviously a problem when you have objects with a very high velocity. If you can achieve what you want to do with a line trace you should.
Well, I don’t know how difficult it would be for you. For example: You could sub-step the motion of the bullet (might get computationally expensive) or you could do a trace from the bullets current position to the position last frame to see it anything was skipped. If you can do what you want to do with a line trace you should absolutely use a line trace. But keep in mind that a line trace checks instantaneously along the whole trace vector, so it is not really the same as a bullet that moves through the air for several frames.
He’s using BoxOverlapActors with OverlapAllDynamic so the collision settings on his mesh/collision are irrelevant. Whether getting the overlaps with all dynamic objects that the bullet passes through is actually what he wants is another question.
His velocity is 250 meters a second…60FPS = 41.667m/frame. 30FPS = 83.3325m/frame.
For any overlapping actor to be considered it would need to be in his 10x10x10 box overlap at start of each tick.
Instead of all this he can simply set his projectiles collision to overlap dynamic. On begin overlap (collision) print something.
If wants to Only hit Pawn capsule he needs to create a new object type for the capsule, replace the capsules current object type. Then set the projectiles collision to block pawn capsule, and overlap dynamic…ignore all others. Done.
All other components in the projectile should have no collision. It bloats the work load.
All true of course, that’s the better/common solution. I just assumed he wanted to know how to make his approach work, but considering the title of the question that was probably not very instructive, my bad.
End of day he needs to be very specific in what he needs his projectile to do…The optimal end result. If he wants to reg hits on pawns, overlap special actors (destructible, damageable etc), but also be blocked by hard world objects (walls, trees, vehicles etc) he’ll need a different setup.