How would you attach a sword into the ground, wall, etc

Hi, I’m trying to program a throwable knife and I wanted to be able to stick those knives into a surface (for example a simple static wall) on impact. They should also only be able to attach via the bladed side. Is there an easy way to do that? Do I need to use sockets in order to attach the bladed side to a wall?

I was thinking to add an onHIt Event that would retrieve the hit point and set the actor location to that point, but I’m thinking there is a better way to do this since I want to attach specifically to the bladed side.

You would need to create collision for the bladed part of the mesh that was separate from the handle, in order to allow the handle to bounce off and the blade to penetrate. The information you get from the blade hit event could then be used to determine all sorts of important collision information such as exact hit location, normal, and velocity. From there the design would really be up to you, but it should be possible, and sounds like cool use of UE4’s collision too!
Hope this helps.
-Spiris

Thank you @Spiris for the fast reply! I wanted to ask about a bit more of an edge case. Say f.e my knife has rotational velocity applied to it, and I want to attach the knife regardless of its orientation to the surface normal (aka, if my knife hits via the handle side, I want to rotate it towards the bladed side and attach it to wall). Would I essentially want to apply rotational forces until the surface hit point and the knife’s blade side are equal?

maybe just use a set location/rotation and snap it to the correct orientation on hit.

i haven’t really done anything like what you’re trying to do, but maybe if you get the unit direction vector and turned that into a rotation somehow (rotation from x vector?)…


there are probably bow and arrow tutorials that have similar systems

if you get it working and don’t mind posting the math I’d be interested in learning how it’s done.