Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.19
more ▼

asked Jun 15 '18 at 09:50 PM in Blueprint Scripting

avatar image

8 1 4 9

avatar image SSDennisDev Jun 15 '18 at 09:52 PM

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.

avatar image Spiris Jun 15 '18 at 10:00 PM

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.

avatar image SSDennisDev Jun 15 '18 at 10:10 PM

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?

avatar image IndieGameCove Jun 16 '18 at 03:30 AM

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?)... https://www.youtube.com/watch?v=_JCWLsRyz0Y

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question