x

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"

Sword Collision

Most of the Pargaon character models also include the sword as a part of the character mesh. I would think that the sword should normally be its own independent mesh that you create an actor for and then attach to the hand via a socket. Then you could check if the sword actor overlaps with any other actors to determine what the player is hitting.

What is a good way to determine what the player hits when the sword is already attached to the character mesh?

Product Version: UE 4.21
Tags:
more ▼

asked Dec 26 '18 at 08:57 PM in C++ Programming

avatar image

jr557
48 10 15 21

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

2 answers: sort voted first

As Evigmae suggested, you would attach either box components or capsule components to the character mesh on the sockets where the weapons are. Then you would use On Component Begin Overlap ( If you are doing this in c++ you need to use:

void functionname(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult); You would also need to add in your constructor: ComponentName->OnComponentBeginOverlap.AddDynmic(this, MyClass::functionname) ).

If you need to return specific components you would also use a shape trace (box trace or capsule trace in BP). Additionally, you would need to make an AActor array and include in your code that if the array does not contain the OtherActor, then add the OtherActor to the array and THEN do your effect (like using the ApplyPointDamage function).

more ▼

answered Dec 27 '18 at 09:10 AM

avatar image

ComposingCoder
33 5 7

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

Nothing is stopping you from attaching a collision volume to the sword socket and use that for hit detection :)

more ▼

answered Dec 26 '18 at 09:26 PM

avatar image

Evigmae
1.7k 8 4 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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