Realist Weapon Collision

Hey everyone i need a idea to do something like this UE4 - Weapon collision vs world - YouTube

Yeahh, I would love to know how he accomplished this. Does anyone know?

I guess you can do that if you use Physics Handle to carry the gun, and snap the hands to the gun, and not the other way around like it’s generally done.

I looked through the comments and the guy who made this wrote a comment explaining how he’s done it (look below for his comment). It doesn’t tell me much as my knowledge is limited but maybe someone else could potentially make more out of it and explain how to make this.

2 years ago
+v8matey

Hello! I don’t have any guides or tutorials unfortunately, but it’s a quite simple setup I used a separate collision actor which gets attached to the gun when the collision is turned on (the gun has a function which first checks for validity so it can still run without it and have correct alignment) The collision actor is positioned and attached along gun longitudinal axis, it has a scene for scale which keeps the capsule start point alway:s aligned at the origin, 1 scene for origin point (shoulder), 1 scene for end-point (muzzle). It uses collision with world static The gun has a function running per tick which checks for validity first, and then performs a 2 vector look-at check from capsule origin, to end point. Then this rotation is inversely transformed
using gun attachment scene transform. The final rotation is applied to gun attachment relative rotation, so basically if the capsule is mis-aligned with the gun, the guns scene is rotated to meet that rotation. I hope that makes sense In this project I use left-hand lK to the gun rail orgrip attachment, but currently I’m working on 3rd person animation set which would use weapon separately from skeleton and 2 hands IK on weapon plus a bit modified collision which would make animation behave differently depending if the weapon is in ironsights or shouldered).