Download

Collision error when close to an object

Good day I have been running into an issue that I have seen in some other unreal based games during development. The issue is that when the player is close to an object, the collision of the object does not seem to apply. For instance when a gun is pressed right up against a rock the bullet fires right through the rock, or when an axe is swung at a rock from close range it does not collide with the rock. A solution to this problem would be very appreciated. I have enabled a collision on the gun itself (developing an FPS), but that did not solve the problem when the gun is placed against the object. I have also tried creating a volume at the end of the barrel with the function that if that is overlapping any object then the gun cannot fire. This worked to an extent but fails when you are attempting to fire through a hole or certain vegetation or if the weapon is pushed against an enemy player. Further I was not happy with this solution as it is not very realistic that the gun just won’t fire when at point blank range. Thank you for any assistance

Does this happen when there’s a collision sphere put around the rock or object ?

Just a shot in the dark here (unintentional pun)

Check where the line trace for the shot is beginning, it is possible that the shot from the gun is creating a line trace which is a beyond the tip of the barrel. This would mean that the “bullet” is being created inside of the object. meaning it bypasses the collision.

Easy fix if this is the issue, adjust the line trace start position.

Yes it does, any collision including a complex collision generated in engine.

Firstly, love the pun
Secondly I had the same thought which I tried and it seems to work. The other solution I am working on is a line trace from the barrel that measures the distance to the object. If the distance is too small then it disables the gun and animates the gun into a “held against the body” position giving the player a visual indication of an issue.

My only concern is that if you have played Fortnite you will see that when in the lobby/warm up area before a match then when swinging the pick axe thing against a rock from distance results in an effect and audio cue, but when too close to the rock the pick simply swings though the rock. Now whether that relates to my issue I do not yet know but did get me thinking that this could be an issue with Unreal that others are experiencing since it is a similar scenario. I have not implemented a melee/swinging system into my game yet but will be interested to see if I encounter this issue. If I do then it would mean that the whole idea of moving the bullet spawn socket further back is only a solution for firearms and that there must be another solution for all objects? Any thoughts