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"

BlockAllDynamic collision is being generated without setting the collision to it

I am having this issue with my C++ pawn. I want to set up a collision layer "Hitbox" which I want my projectile to detect. My projectile uses a multi line trace and checks the hit results for this collision layer. It works the way I want it to when I have the static meshes of the pawn placed manually into the scene. However, when I have them generated in my pawn class, there seems to have been a BlockAllDynamic layer overriding these collision layers in the C++ class. This is very frustrating because I never access or use collision presets in my code in any way, and something seems to be changing it without my knowledge or consent. No means no, Unreal.

I simply create the static mesh default subobjects and want to check their collision layers. The reason I have separate collision layers in one pawn is because I use forces to leverage the physics of the main body mesh, and want the hitbox collisions to have no effect on the physics, only to be detected by the projectiles.

Projectile class (inside Tick):

... UKismetSystemLibrary::LineTraceMulti_NEW(this, Start, End, ETraceTypeQuery::TraceTypeQuery2, false, TArray (), EDrawDebugTrace::ForDuration, Hits, true, FLinearColor::Red, FLinearColor::Green, 5.f);

 for (int i = 0; i < Hits.Num(); i++)
 {
     Hit = Hits[i];
     GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Yellow, Hit.GetComponent()->GetCollisionProfileName().ToString());
     if (Hit.GetComponent()->GetCollisionProfileName() == FName("Hitbox"))
     {
         GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Green, "Hitbox!");
     }
 }

...

Pawn class (inside ctor):

... B_Hitbox = CreateDefaultSubobject(TEXT("Back Hitbox")); B_Hitbox->AttachToComponent(Chassis, FAttachmentTransformRules::KeepRelativeTransform, NAME_None); B_Hitbox->SetVisibility(false); ...

Product Version: UE 4.14
Tags:
more ▼

asked Jan 22 '17 at 11:36 AM in C++ Programming

avatar image

gstetsyuk
8 1 2 6

(comments are locked)
10|2000 characters needed characters left

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